diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2021-12-03 16:56:01 +0000 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2021-12-03 16:56:01 +0000 |
commit | f9b66da748a2940d5dbf60b5c2f12cee0c41e1eb (patch) | |
tree | 9e691f5d30a653351db8583174a9ff5707e5a2be /scene/gui | |
parent | 0e261523926e776bc0b1b85178a60fa476490a9c (diff) |
Fixed TextEdit underline draw pos
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index dedcc266e0..bc30bf4447 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1056,7 +1056,7 @@ void TextEdit::_notification(int p_what) { while (highlighted_word_col != -1) { Vector<Vector2> sel = TS->shaped_text_get_selection(rid, highlighted_word_col + start, highlighted_word_col + lookup_symbol_word.length() + start); for (int j = 0; j < sel.size(); j++) { - Rect2 rect = Rect2(sel[j].x + char_margin + ofs_x, ofs_y, sel[j].y - sel[j].x, row_height); + Rect2 rect = Rect2(sel[j].x + char_margin + ofs_x, ofs_y + (line_spacing / 2), sel[j].y - sel[j].x, row_height); if (rect.position.x + rect.size.x <= xmargin_beg || rect.position.x > xmargin_end) { continue; } @@ -1066,9 +1066,9 @@ void TextEdit::_notification(int p_what) { } else if (rect.position.x + rect.size.x > xmargin_end) { rect.size.x = xmargin_end - rect.position.x; } - rect.position.y = TS->shaped_text_get_ascent(rid) + font->get_underline_position(font_size); - rect.size.y = font->get_underline_thickness(font_size); - draw_rect(rect, font_selected_color); + rect.position.y += ceil(TS->shaped_text_get_ascent(rid)) + ceil(font->get_underline_position(font_size)); + rect.size.y = MAX(1, font->get_underline_thickness(font_size)); + draw_rect(rect, color); } highlighted_word_col = _get_column_pos_of_word(lookup_symbol_word, str, SEARCH_MATCH_CASE | SEARCH_WHOLE_WORDS, highlighted_word_col + 1); |