mirror of
https://github.com/RGBCube/serenity
synced 2025-10-14 03:52:06 +00:00
26 lines
438 B
C++
26 lines
438 B
C++
#include "InsertOperation.h"
|
|
#include "Editor.h"
|
|
|
|
InsertOperation::InsertOperation(const std::string& text)
|
|
: m_text(text)
|
|
{
|
|
}
|
|
|
|
InsertOperation::InsertOperation(char ch)
|
|
: m_text(&ch, 1)
|
|
{
|
|
}
|
|
|
|
InsertOperation::~InsertOperation()
|
|
{
|
|
}
|
|
|
|
bool InsertOperation::apply(Editor& editor)
|
|
{
|
|
return editor.insert_text_at_cursor(m_text);
|
|
}
|
|
|
|
bool InsertOperation::unapply(Editor& editor)
|
|
{
|
|
return editor.remove_text_at_cursor(m_text);
|
|
}
|