Add TestFrontend documentation and UndoSystem buffer reference update.

- Document `TestFrontend` for programmatic testing, including examples and usage details.
- Add `UpdateBufferReference` to `UndoSystem` to support updating buffer associations.
This commit is contained in:
2025-11-30 02:56:39 -08:00
parent 91bc986e51
commit 8c8e4e59a4
21 changed files with 5889 additions and 2531 deletions

38
TestInputHandler.cc Normal file
View File

@@ -0,0 +1,38 @@
#include "TestInputHandler.h"
bool
TestInputHandler::Poll(MappedInput &out)
{
if (queue_.empty())
return false;
out = queue_.front();
queue_.pop();
return true;
}
void
TestInputHandler::QueueCommand(CommandId id, const std::string &arg, int count)
{
MappedInput mi;
mi.hasCommand = true;
mi.id = id;
mi.arg = arg;
mi.count = count;
queue_.push(mi);
}
void
TestInputHandler::QueueText(const std::string &text)
{
for (char ch: text) {
MappedInput mi;
mi.hasCommand = true;
mi.id = CommandId::InsertText;
mi.arg = std::string(1, ch);
mi.count = 0;
queue_.push(mi);
}
}