diff options
author | miwanczuk <miwanczuk7@gmail.com> | 2019-04-27 18:02:09 +0200 |
---|---|---|
committer | miwanczuk <miwanczuk7@gmail.com> | 2019-04-30 09:59:59 +0200 |
commit | 1001c7fddee91b6c1c64acdf548d6d93ddbe01ec (patch) | |
tree | ff84743e0547aad3d2c839b39cf134100f5e6d69 | |
parent | a0180fa86ec54ac4f7e1b7c8f154364f0525b76a (diff) |
issue-28446 - disable higlighting all occurences of string in editor if only whitespaces are selected
-rw-r--r-- | scene/gui/text_edit.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 1f498ea16e..8a17b872d0 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -825,6 +825,9 @@ void TextEdit::_notification(int p_what) { // get the highlighted words String highlighted_text = get_selection_text(); + // check if highlighted words contains only whitespaces (tabs or spaces) + bool only_whitespaces_highlighted = highlighted_text.strip_edges() == String(); + String line_num_padding = line_numbers_zero_padded ? "0" : " "; int cursor_wrap_index = get_cursor_wrap_index(); @@ -1105,7 +1108,7 @@ void TextEdit::_notification(int p_what) { VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + char_w + ofs_x - 1, ofs_y), Size2i(1, get_row_height())), border_color); } - if (highlight_all_occurrences) { + if (highlight_all_occurrences && !only_whitespaces_highlighted) { if (highlighted_text_col != -1) { // if we are at the end check for new word on same line |