summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-08-05 17:19:37 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-05 17:27:14 +0200
commit9ef834384d68140f0a0e0bc02ca4957ffae77960 (patch)
tree4b930219e548a2fe6114b2e6ce90b71f8054e7c4
parente2b4fef6c75070febdc689d7fadc21eb28c2315d (diff)
downloadserenity-9ef834384d68140f0a0e0bc02ca4957ffae77960.zip
LibGUI: Use set_cursor() in TextEditor::set_document()
Instead of setting m_cursor directly to reset the cursor position, TextEditor::set_document() now uses set_cursor() which will call cursor change callback functions, if any. This fixes a bug in HackStudio where the cursor information text would not update immediately after changing the active TextDocument, even though the cursor is always visibly being reset to 0, 0.
-rw-r--r--Libraries/LibGUI/TextEditor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp
index 2e308c1870..50cd6b989f 100644
--- a/Libraries/LibGUI/TextEditor.cpp
+++ b/Libraries/LibGUI/TextEditor.cpp
@@ -1659,7 +1659,7 @@ void TextEditor::set_document(TextDocument& document)
for (size_t i = 0; i < m_document->line_count(); ++i) {
m_line_visual_data.append(make<LineVisualData>());
}
- m_cursor = { 0, 0 };
+ set_cursor(0, 0);
if (has_selection())
m_selection.clear();
recompute_all_visual_lines();