Skip to content

Commit

Permalink
Merge pull request #89625 from kitbdev/not-the-end-of-the-line
Browse files Browse the repository at this point in the history
Fix TextEdit selection end of line drawing for wrapped lines and gaps
  • Loading branch information
akien-mga committed Mar 26, 2024
2 parents 4dec783 + 63ac8c1 commit 37766c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ void TextEdit::_notification(int p_what) {
Vector<Vector2> sel = TS->shaped_text_get_selection(rid, sel_from, sel_to);

// Show selection at the end of line.
if (line < get_selection_to_line(c)) {
if (line_wrap_index == line_wrap_amount && line < get_selection_to_line(c)) {
if (rtl) {
sel.push_back(Vector2(-char_w, 0));
} else {
Expand All @@ -1123,7 +1123,7 @@ void TextEdit::_notification(int p_what) {
}

for (int j = 0; j < sel.size(); j++) {
Rect2 rect = Rect2(sel[j].x + char_margin + ofs_x, ofs_y, Math::ceil(sel[j].y - sel[j].x), row_height);
Rect2 rect = Rect2(sel[j].x + char_margin + ofs_x, ofs_y, Math::ceil(sel[j].y) - sel[j].x, row_height);
if (rect.position.x + rect.size.x <= xmargin_beg || rect.position.x > xmargin_end) {
continue;
}
Expand Down

0 comments on commit 37766c4

Please sign in to comment.