diff options
| author | binbitten | 2018-01-31 18:59:19 +0100 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-02-04 20:06:46 +0100 |
| commit | 0fa432515329233e624f89d8500503f4fba85f0b (patch) | |
| tree | b23922c8e9c8196545e6596e12d8a9580a12a877 /scene/gui/text_edit.cpp | |
| parent | acf01c955f2c8505975bf1acfeb32036f6fcfc89 (diff) | |
| download | godot-0fa432515329233e624f89d8500503f4fba85f0b.tar.gz godot-0fa432515329233e624f89d8500503f4fba85f0b.tar.zst godot-0fa432515329233e624f89d8500503f4fba85f0b.zip | |
Fix TextEdit current line highlight horizontal offset
(cherry picked from commit ba8c5bff69a776322a7633e9d3e18da5257039ff)
Diffstat (limited to '')
| -rw-r--r-- | scene/gui/text_edit.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 95bd676a0..f72849013 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -890,7 +890,7 @@ void TextEdit::_notification(int p_what) { } else { // if it has text, then draw current line marker in the margin, as line number etc will draw over it, draw the rest of line marker later. if (line == cursor.line && highlight_current_line) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_beg, get_row_height()), cache.current_line_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_beg + ofs_x, get_row_height()), cache.current_line_color); } } @@ -1122,14 +1122,14 @@ void TextEdit::_notification(int p_what) { // line highlighting handle horizontal clipping if (line == cursor.line && highlight_current_line) { - // char next to margin is skipped - if ((char_ofs + char_margin) > xmargin_beg) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, (char_ofs + char_margin) - (xmargin_beg + ofs_x), get_row_height()), cache.current_line_color); - } - // end of line when last char is skipped if (j == str.length() - 1) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - (char_ofs + char_margin + char_w), get_row_height()), cache.current_line_color); + // end of line when last char is skipped + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - (xmargin_beg + ofs_x), get_row_height()), cache.current_line_color); + + } else if ((char_ofs + char_margin) > xmargin_beg) { + // char next to margin is skipped + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, (char_ofs + char_margin) - xmargin_beg, get_row_height()), cache.current_line_color); } } continue; |
