فهرست منبع

LibGUI: Don't update selection twice after Ctrl-Right

Ben Wiederhake 3 سال پیش
والد
کامیت
3647001c93
2فایلهای تغییر یافته به همراه3 افزوده شده و 7 حذف شده
  1. 2 6
      Userland/Libraries/LibGUI/EditingEngine.cpp
  2. 1 1
      Userland/Libraries/LibGUI/EditingEngine.h

+ 2 - 6
Userland/Libraries/LibGUI/EditingEngine.cpp

@@ -79,7 +79,7 @@ bool EditingEngine::on_key(const KeyEvent& event)
         }
         }
         if (event.ctrl()) {
         if (event.ctrl()) {
             m_editor->update_selection(event.shift());
             m_editor->update_selection(event.shift());
-            move_to_next_span(event);
+            move_to_next_span();
             if (event.shift() && m_editor->selection().start().is_valid()) {
             if (event.shift() && m_editor->selection().start().is_valid()) {
                 m_editor->selection().set_end(m_editor->cursor());
                 m_editor->selection().set_end(m_editor->cursor());
                 m_editor->did_update_selection();
                 m_editor->did_update_selection();
@@ -217,7 +217,7 @@ void EditingEngine::move_to_previous_span()
     m_editor->set_cursor(new_cursor);
     m_editor->set_cursor(new_cursor);
 }
 }
 
 
-void EditingEngine::move_to_next_span(const KeyEvent& event)
+void EditingEngine::move_to_next_span()
 {
 {
     TextPosition new_cursor;
     TextPosition new_cursor;
     if (m_editor->document().has_spans()) {
     if (m_editor->document().has_spans()) {
@@ -232,10 +232,6 @@ void EditingEngine::move_to_next_span(const KeyEvent& event)
         new_cursor = m_editor->document().first_word_break_after(m_editor->cursor());
         new_cursor = m_editor->document().first_word_break_after(m_editor->cursor());
     }
     }
     m_editor->set_cursor(new_cursor);
     m_editor->set_cursor(new_cursor);
-    if (event.shift() && m_editor->selection().start().is_valid()) {
-        m_editor->selection().set_end(m_editor->cursor());
-        m_editor->did_update_selection();
-    }
 }
 }
 
 
 void EditingEngine::move_to_logical_line_beginning()
 void EditingEngine::move_to_logical_line_beginning()

+ 1 - 1
Userland/Libraries/LibGUI/EditingEngine.h

@@ -47,7 +47,7 @@ protected:
     void move_one_up(const KeyEvent& event);
     void move_one_up(const KeyEvent& event);
     void move_one_down(const KeyEvent& event);
     void move_one_down(const KeyEvent& event);
     void move_to_previous_span();
     void move_to_previous_span();
-    void move_to_next_span(const KeyEvent& event);
+    void move_to_next_span();
     void move_to_logical_line_beginning();
     void move_to_logical_line_beginning();
     void move_to_logical_line_end();
     void move_to_logical_line_end();
     void move_to_line_beginning();
     void move_to_line_beginning();