diff options
Diffstat (limited to 'LibGUI')
-rw-r--r-- | LibGUI/GTextEditor.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/LibGUI/GTextEditor.cpp b/LibGUI/GTextEditor.cpp index be027349b2..0b350fb51e 100644 --- a/LibGUI/GTextEditor.cpp +++ b/LibGUI/GTextEditor.cpp @@ -496,8 +496,8 @@ void GTextEditor::do_delete() if (m_cursor.column() < current_line().length()) { // Delete within line current_line().remove(m_cursor.column()); - update_cursor(); did_change(); + update_cursor(); return; } if (m_cursor.column() == current_line().length() && m_cursor.line() != line_count() - 1) { @@ -507,8 +507,8 @@ void GTextEditor::do_delete() current_line().append(next_line.characters(), next_line.length()); m_lines.remove(m_cursor.line() + 1); update(); - set_cursor(m_cursor.line(), previous_length); did_change(); + set_cursor(m_cursor.line(), previous_length); return; } } @@ -534,8 +534,8 @@ void GTextEditor::insert_at_cursor(char ch) if (at_tail || at_head) { m_lines.insert(m_cursor.line() + (at_tail ? 1 : 0), make<Line>()); update(); - set_cursor(m_cursor.line() + 1, 0); did_change(); + set_cursor(m_cursor.line() + 1, 0); return; } auto new_line = make<Line>(); @@ -543,8 +543,8 @@ void GTextEditor::insert_at_cursor(char ch) current_line().truncate(m_cursor.column()); m_lines.insert(m_cursor.line() + 1, move(new_line)); update(); - set_cursor(m_cursor.line() + 1, 0); did_change(); + set_cursor(m_cursor.line() + 1, 0); return; } if (ch == '\t') { @@ -553,15 +553,13 @@ void GTextEditor::insert_at_cursor(char ch) for (int i = 0; i < spaces_to_insert; ++i) { current_line().insert(m_cursor.column(), ' '); } - set_cursor(m_cursor.line(), next_soft_tab_stop); - update_cursor(); did_change(); + set_cursor(m_cursor.line(), next_soft_tab_stop); return; } current_line().insert(m_cursor.column(), ch); - set_cursor(m_cursor.line(), m_cursor.column() + 1); - update_cursor(); did_change(); + set_cursor(m_cursor.line(), m_cursor.column() + 1); } int GTextEditor::content_x_for_position(const GTextPosition& position) const @@ -862,9 +860,9 @@ void GTextEditor::delete_selection() m_selection.clear(); did_update_selection(); + did_change(); set_cursor(selection.start()); update(); - did_change(); } void GTextEditor::insert_at_cursor_or_replace_selection(const String& text) |