diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-01-14 17:22:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-14 17:22:09 +0100 |
commit | a1a67e6e84bf84a00f5b7a5941bd6e0be9bada83 (patch) | |
tree | 3186d512d195b2f3a4c8127cfd8f9f827cdd21cd | |
parent | 515da5b08ba56440800cb9f5793230fd5c930eed (diff) | |
parent | 386c57cfad60cba7af4c00b90600ac9801d3edbd (diff) |
Merge pull request #15708 from Paulb23/current_line_clipping_issue_15427
Fixed current line highlighting with horizontal clipping, issue 15427
-rw-r--r-- | scene/gui/text_edit.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 439b0ce605..4d87a6b3ba 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1119,6 +1119,19 @@ void TextEdit::_notification(int p_what) { if ((char_ofs + char_margin) < xmargin_beg) { char_ofs += char_w; + + // 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); + } + } continue; } |