Merge pull request #77667 from RedworkDE/text-edit-selection-crash

Fix crash when selecting lines in text edit
This commit is contained in:
Rémi Verschelde 2023-06-12 17:10:04 +02:00
commit fa536571a4
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -7161,7 +7161,9 @@ void TextEdit::_update_selection_mode_line() {
if (line < carets[caret_idx].selection.selecting_line) {
// Caret is above us.
set_caret_line(line - 1, false, true, 0, caret_idx);
carets.write[caret_idx].selection.selecting_column = text[get_selection_line(caret_idx)].length();
carets.write[caret_idx].selection.selecting_column = has_selection(caret_idx)
? text[get_selection_line(caret_idx)].length()
: 0;
} else {
// Caret is below us.
set_caret_line(line + 1, false, true, 0, caret_idx);