Merge pull request #5777 from Paulb23/caret_stretching

Fixed caret width on tabs
This commit is contained in:
Rémi Verschelde 2016-07-18 16:57:12 +02:00 committed by GitHub
commit e91bd708d9

View file

@ -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);
}
}