From c7519f091d6c4bd3f7edc1b8213fb4aa418fad3a Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Tue, 5 Apr 2016 17:06:56 +0100 Subject: Ability to change the caret color --- scene/gui/text_edit.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scene/gui/text_edit.cpp') diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 425a88fc0e..321bbb9338 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -910,9 +910,9 @@ void TextEdit::_notification(int p_what) { cursor_pos = Point2i( char_ofs+char_margin, ofs_y ); if (insert_mode) { cursor_pos.y += get_row_height(); - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.font_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.caret_color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.font_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.caret_color); } @@ -927,9 +927,9 @@ void TextEdit::_notification(int p_what) { if (insert_mode) { cursor_pos.y += get_row_height(); int char_w = cache.font->get_char_size(' ').width; - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.font_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.caret_color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.font_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.caret_color); } } } @@ -3045,6 +3045,7 @@ void TextEdit::_update_caches() { cache.style_normal=get_stylebox("normal"); cache.style_focus=get_stylebox("focus"); cache.font=get_font("font"); + cache.caret_color=get_color("caret_color"); cache.font_color=get_color("font_color"); cache.font_selected_color=get_color("font_selected_color"); cache.keyword_color=get_color("keyword_color"); -- cgit v1.2.3