Skip to content

Commit f13c62f

Browse files
committed
GTextEditor: Fix double effect of backspace/delete in some cases.
1 parent a738b5c commit f13c62f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

LibGUI/GTextEditor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ void GTextEditor::keydown_event(GKeyEvent& event)
213213
current_line().remove(m_cursor.column() - 1);
214214
update_scrollbar_ranges();
215215
set_cursor(m_cursor.line(), m_cursor.column() - 1);
216+
return;
216217
}
217218
if (m_cursor.column() == 0 && m_cursor.line() != 0) {
218219
// Backspace at column 0; merge with previous line
@@ -223,6 +224,7 @@ void GTextEditor::keydown_event(GKeyEvent& event)
223224
update_scrollbar_ranges();
224225
update();
225226
set_cursor(m_cursor.line() - 1, previous_length);
227+
return;
226228
}
227229
return;
228230
}
@@ -233,6 +235,7 @@ void GTextEditor::keydown_event(GKeyEvent& event)
233235
current_line().remove(m_cursor.column());
234236
update_scrollbar_ranges();
235237
update_cursor();
238+
return;
236239
}
237240
if (m_cursor.column() == (current_line().length() + 1) && m_cursor.line() != line_count() - 1) {
238241
// Delete at end of line; merge with next line
@@ -243,6 +246,7 @@ void GTextEditor::keydown_event(GKeyEvent& event)
243246
update_scrollbar_ranges();
244247
update();
245248
set_cursor(m_cursor.line(), previous_length);
249+
return;
246250
}
247251
return;
248252
}

0 commit comments

Comments
 (0)