From 2f80965845dd40c4a7981b0d3f011f26c185d63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Mon, 10 Oct 2016 00:10:13 +0200 Subject: [PATCH] Make text column numbers one-based Make one-based the column number on the code editor Make one-based the column number for GDScript error messages Make one-based the column number for shader code error messages --- modules/gdscript/gd_tokenizer.cpp | 2 +- tools/editor/code_editor.cpp | 2 +- tools/editor/plugins/shader_editor_plugin.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 2041ec12ad0..383a092d96a 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -943,7 +943,7 @@ void GDTokenizerText::set_code(const String& p_code) { } code_pos=0; line=1; //it is stand-ar-ized that lines begin in 1 in code.. - column=0; + column=1; //the same holds for columns tk_rb_pos=0; error_flag=false; last_error=""; diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index 9240e3527ca..b43a3e9ca7b 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -1051,7 +1051,7 @@ void CodeTextEditor::_reset_zoom() { void CodeTextEditor::_line_col_changed() { line_nb->set_text(itos(text_editor->cursor_get_line() + 1)); - col_nb->set_text(itos(text_editor->cursor_get_column())); + col_nb->set_text(itos(text_editor->cursor_get_column() + 1)); } void CodeTextEditor::_text_changed() { diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index b3317e83138..39efde8beac 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -155,7 +155,7 @@ void ShaderTextEditor::_validate_script() { Error err = ShaderLanguage::compile(code,type,NULL,NULL,&errortxt,&line,&col); if (err!=OK) { - String error_text="error("+itos(line+1)+","+itos(col)+"): "+errortxt; + String error_text="error("+itos(line+1)+","+itos(col+1)+"): "+errortxt; set_error(error_text); get_text_edit()->set_line_as_marked(line,true);