summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorFalseHonesty <thefalsehonesty@gmail.com>2020-05-29 15:43:06 -0400
committerAndreas Kling <kling@serenityos.org>2020-05-29 22:14:45 +0200
commit061938206a53992707ca123ef7224a0f517e147c (patch)
tree25a8d738f94f86464da79ad61c62ac18ec3c14d0 /Libraries
parent4d4e578edfde7299cfbebce8af9f34b82b0fbd21 (diff)
downloadserenity-061938206a53992707ca123ef7224a0f517e147c.zip
LibGUI: Fix cursor being out of view after typing
Previously, if the cursor moved out of the visible area while text was being inserted, the text editor would never scroll the cursor back into view until the arrow keys were pressed to move the cursor. This was caused by the TextEditor's reflow deferral system stopping visual line recomputation until the end of text insertion, so now when reflow deferral is completed, the TextEditor will make sure the cursor is visible.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibGUI/TextEditor.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp
index 29fa597fdd..b5cdf78a0f 100644
--- a/Libraries/LibGUI/TextEditor.cpp
+++ b/Libraries/LibGUI/TextEditor.cpp
@@ -1244,8 +1244,10 @@ void TextEditor::undefer_reflow()
{
ASSERT(m_reflow_deferred);
if (!--m_reflow_deferred) {
- if (m_reflow_requested)
+ if (m_reflow_requested) {
recompute_all_visual_lines();
+ scroll_cursor_into_view();
+ }
}
}