ソースを参照

LibGUI+GMLPlayground: Reset cursor to end of text after replace

SimonFJ20 3 年 前
コミット
50ca1b3d87
1 ファイル変更1 行追加0 行削除
  1. 1 0
      Userland/Libraries/LibGUI/TextDocument.cpp

+ 1 - 0
Userland/Libraries/LibGUI/TextDocument.cpp

@@ -905,6 +905,7 @@ void ReplaceAllTextCommand::undo()
     m_document.remove(m_range);
     m_document.remove(m_range);
     m_document.set_all_cursors(m_range.start());
     m_document.set_all_cursors(m_range.start());
     auto new_cursor = m_document.insert_at(m_range.start(), m_text);
     auto new_cursor = m_document.insert_at(m_range.start(), m_text);
+    m_range.set_end(new_cursor);
     m_document.set_all_cursors(new_cursor);
     m_document.set_all_cursors(new_cursor);
 }
 }