diff options
author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2018-07-05 04:04:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-05 04:04:39 +0200 |
commit | 16f1a773192c46cc86c3fbe549c917fd8927faf6 (patch) | |
tree | 0549839b1764a1736c42b875b60ce5ba5dc6780f /scene/gui/line_edit.cpp | |
parent | 43748f67be6b7ba68ed2e941d30d753e1868a567 (diff) | |
parent | 8f390da4229ca10e8c53aa21e5d04fe57190a0b8 (diff) | |
download | redot-engine-16f1a773192c46cc86c3fbe549c917fd8927faf6.tar.gz |
Merge pull request #19735 from Paulb23/text_offset_issue_15688
Fixed text drawing too high in TextEdit, issue 15688
Diffstat (limited to 'scene/gui/line_edit.cpp')
-rw-r--r-- | scene/gui/line_edit.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 0cd5219f8f..b71a4dd133 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -711,7 +711,8 @@ void LineEdit::_notification(int p_what) { if (selected) VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(char_width, caret_height)), selection_color); - drawer.draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, selected ? font_color_selected : font_color); + int yofs = y_ofs + (caret_height - font->get_height()) / 2; + drawer.draw_char(ci, Point2(x_ofs, yofs + font_ascent), cchar, next, selected ? font_color_selected : font_color); if (char_ofs == cursor_pos && draw_caret) { if (ime_text.length() == 0) { |