diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2016-07-18 15:15:40 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2016-07-18 15:15:40 +0100 |
commit | 5505f0c776c709a52f6db9b87a928cae35693b06 (patch) | |
tree | 638d055dd8fe08cb95718d216c42ef66e3396f5b | |
parent | 254d79a560781e9f86debcc63ef6726cfd81ac80 (diff) |
Fixed caret width on tabs
-rw-r--r-- | scene/gui/text_edit.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 46b64ce401..50b44c55a9 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1007,12 +1007,13 @@ void TextEdit::_notification(int p_what) { cursor_pos.y += (get_row_height() - 3); } + int caret_w = (str[j]=='\t') ? cache.font->get_char_size(' ').width : char_w; if (draw_caret) { if (insert_mode) { int caret_h = (block_caret) ? 4 : 1; - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,caret_h)),cache.caret_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(caret_w,caret_h)),cache.caret_color); } else { - int caret_w = (block_caret) ? char_w : 1; + caret_w = (block_caret) ? caret_w : 1; VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(caret_w,get_row_height())),cache.caret_color); } } |