Browse Source

LibGUI: Don't scroll cursor into view while reflows are deferred

We don't have up-to-date visual line rects until after reflow, and we
already do a "scroll cursor into view" when deferral ends anyway.

Fixes #2524.
Andreas Kling 5 years ago
parent
commit
b81b2a85c4
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Libraries/LibGUI/TextEditor.cpp

+ 2 - 1
Libraries/LibGUI/TextEditor.cpp

@@ -1032,7 +1032,8 @@ void TextEditor::scroll_position_into_view(const TextPosition& position)
 
 
 void TextEditor::scroll_cursor_into_view()
 void TextEditor::scroll_cursor_into_view()
 {
 {
-    scroll_position_into_view(m_cursor);
+    if (!m_reflow_deferred)
+        scroll_position_into_view(m_cursor);
 }
 }
 
 
 Gfx::Rect TextEditor::line_content_rect(size_t line_index) const
 Gfx::Rect TextEditor::line_content_rect(size_t line_index) const