summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-07-18 16:57:12 +0200
committerGitHub <noreply@github.com>2016-07-18 16:57:12 +0200
commite91bd708d91fba94b97eb6bebea5752e85d8debf (patch)
treeace2b77b4fb9f3726d5ad08246538e4defac749a
parentf53e7efefed8767cdf049f2ae942e4643144be22 (diff)
parent5505f0c776c709a52f6db9b87a928cae35693b06 (diff)
Merge pull request #5777 from Paulb23/caret_stretching
Fixed caret width on tabs
-rw-r--r--scene/gui/text_edit.cpp5
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);
}
}