mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Ability to change the caret color
This commit is contained in:
parent
8688723923
commit
c7519f091d
@ -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");
|
||||
|
@ -73,6 +73,7 @@ class TextEdit : public Control {
|
||||
Ref<StyleBox> style_normal;
|
||||
Ref<StyleBox> style_focus;
|
||||
Ref<Font> font;
|
||||
Color caret_color;
|
||||
Color font_color;
|
||||
Color font_selected_color;
|
||||
Color keyword_color;
|
||||
|
@ -392,6 +392,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
||||
hints["global/default_project_export_path"]=PropertyInfo(Variant::STRING,"global/default_project_export_path",PROPERTY_HINT_GLOBAL_DIR);
|
||||
set("global/show_script_in_scene_tabs",false);
|
||||
set("text_editor/background_color",Color::html("3b000000"));
|
||||
set("text_editor/caret_color",Color::html("aaaaaa"));
|
||||
set("text_editor/text_color",Color::html("aaaaaa"));
|
||||
set("text_editor/text_selected_color",Color::html("000000"));
|
||||
set("text_editor/keyword_color",Color::html("ffffb3"));
|
||||
|
@ -288,6 +288,7 @@ void ScriptTextEditor::_load_theme_settings() {
|
||||
|
||||
get_text_edit()->set_custom_bg_color(EDITOR_DEF("text_editor/background_color",Color(0,0,0,0)));
|
||||
get_text_edit()->add_color_override("font_color",EDITOR_DEF("text_editor/text_color",Color(0,0,0)));
|
||||
get_text_edit()->add_color_override("caret_color",EDITOR_DEF("text_editor/caret_color",Color(0,0,0)));
|
||||
get_text_edit()->add_color_override("font_selected_color",EDITOR_DEF("text_editor/text_selected_color",Color(1,1,1)));
|
||||
get_text_edit()->add_color_override("selection_color",EDITOR_DEF("text_editor/selection_color",Color(0.2,0.2,1)));
|
||||
get_text_edit()->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/brace_mismatch_color",Color(1,0.2,0.2)));
|
||||
|
Loading…
Reference in New Issue
Block a user