diff options
| author | Pawel Kowal | 2016-09-28 22:05:34 +0200 |
|---|---|---|
| committer | Rémi Verschelde | 2016-10-09 17:23:02 +0200 |
| commit | d7925ca09db60e297b2feef531ce7083c93ef5d1 (patch) | |
| tree | 26746568db90cfeff9382d056fd72f39b7a33673 /scene/gui/line_edit.cpp | |
| parent | d6139523005d303d468f8e903f4b444ae5053ab6 (diff) | |
| download | godot-d7925ca09db60e297b2feef531ce7083c93ef5d1.tar.gz godot-d7925ca09db60e297b2feef531ce7083c93ef5d1.tar.zst godot-d7925ca09db60e297b2feef531ce7083c93ef5d1.zip | |
LineEdit long indicator, fix #6624
(cherry picked from commit 3edc0a48320376021cf7f5dee47311789274744a)
Diffstat (limited to '')
| -rw-r--r-- | scene/gui/line_edit.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 49ab5781a..caac2c107 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -642,6 +642,7 @@ void LineEdit::_notification(int p_what) { if(text.empty()) font_color.a *= placeholder_alpha; + int caret_height = font->get_height() > y_area ? y_area : font->get_height(); while(true) { //end of string, break! @@ -660,14 +661,14 @@ void LineEdit::_notification(int p_what) { bool selected=selection.enabled && char_ofs>=selection.begin && char_ofs<selection.end; if (selected) - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(char_width, y_area)), selection_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(char_width, caret_height)), selection_color); font->draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, selected ? font_color_selected : font_color); if (char_ofs==cursor_pos && draw_caret) { VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( - Point2( x_ofs , y_ofs ), Size2( 1, y_area ) ), cursor_color ); + Point2( x_ofs , y_ofs ), Size2( 1, caret_height ) ), cursor_color ); } x_ofs+=char_width; @@ -676,7 +677,7 @@ void LineEdit::_notification(int p_what) { if (char_ofs==cursor_pos && draw_caret) {//may be at the end VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( - Point2( x_ofs , y_ofs ), Size2( 1, y_area ) ), cursor_color ); + Point2( x_ofs , y_ofs ), Size2( 1, caret_height ) ), cursor_color ); } } break; case NOTIFICATION_FOCUS_ENTER: { |
