mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 01:59:14 +03:00
TextEditor: Fix bug in delete_current_line() when deleting the last line
A missing '- 1' when initializing the starting TextPosition lead to a crash due to attempting to delete text in an illegal TextRange.
This commit is contained in:
parent
ed703b461b
commit
94bfde2a38
Notes:
sideshowbarker
2024-07-18 22:51:38 +09:00
Author: https://github.com/supex0fan Commit: https://github.com/SerenityOS/serenity/commit/94bfde2a385 Pull-request: https://github.com/SerenityOS/serenity/pull/5103
@ -770,7 +770,7 @@ void TextEditor::delete_current_line()
|
||||
start = { 0, 0 };
|
||||
end = { 0, line(0).length() };
|
||||
} else if (m_cursor.line() == line_count() - 1) {
|
||||
start = { m_cursor.line() - 1, line(m_cursor.line()).length() };
|
||||
start = { m_cursor.line() - 1, line(m_cursor.line() - 1).length() };
|
||||
end = { m_cursor.line(), line(m_cursor.line()).length() };
|
||||
} else {
|
||||
start = { m_cursor.line(), 0 };
|
||||
|
Loading…
Reference in New Issue
Block a user