|
@@ -762,7 +762,7 @@ String InsertTextCommand::action_text() const
|
|
|
|
|
|
bool InsertTextCommand::merge_with(GUI::Command const& other)
|
|
|
{
|
|
|
- if (!is<InsertTextCommand>(other))
|
|
|
+ if (!is<InsertTextCommand>(other) || commit_time_expired())
|
|
|
return false;
|
|
|
|
|
|
auto const& typed_other = static_cast<InsertTextCommand const&>(other);
|
|
@@ -780,6 +780,7 @@ bool InsertTextCommand::merge_with(GUI::Command const& other)
|
|
|
m_text = builder.to_string();
|
|
|
m_range.set_end(typed_other.m_range.end());
|
|
|
|
|
|
+ m_timestamp = Time::now_monotonic();
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -862,19 +863,24 @@ String RemoveTextCommand::action_text() const
|
|
|
|
|
|
bool RemoveTextCommand::merge_with(GUI::Command const& other)
|
|
|
{
|
|
|
- if (!is<RemoveTextCommand>(other))
|
|
|
+ if (!is<RemoveTextCommand>(other) || commit_time_expired())
|
|
|
return false;
|
|
|
- auto& typed_other = static_cast<RemoveTextCommand const&>(other);
|
|
|
+
|
|
|
+ auto const& typed_other = static_cast<RemoveTextCommand const&>(other);
|
|
|
+
|
|
|
if (m_range.start() != typed_other.m_range.end())
|
|
|
return false;
|
|
|
if (m_range.start().line() != m_range.end().line())
|
|
|
return false;
|
|
|
+
|
|
|
// Merge backspaces
|
|
|
StringBuilder builder(m_text.length() + typed_other.m_text.length());
|
|
|
builder.append(typed_other.m_text);
|
|
|
builder.append(m_text);
|
|
|
m_text = builder.to_string();
|
|
|
m_range.set_start(typed_other.m_range.start());
|
|
|
+
|
|
|
+ m_timestamp = Time::now_monotonic();
|
|
|
return true;
|
|
|
}
|
|
|
|