aboutsummaryrefslogtreecommitdiff
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
authorUnknown2018-05-03 18:03:20 +0100
committerUnknown2018-05-03 18:03:20 +0100
commit4e26e5e26855c29e47f4e38f03c0f697af5b8c2d (patch)
treea15426d2df79f25782c1b826da700f388ca9a8c2 /editor/code_editor.cpp
parentb774156729b4b2f8a1fea6faf6e232fe809ea6f6 (diff)
downloadgodot-4e26e5e26855c29e47f4e38f03c0f697af5b8c2d.tar.gz
godot-4e26e5e26855c29e47f4e38f03c0f697af5b8c2d.tar.zst
godot-4e26e5e26855c29e47f4e38f03c0f697af5b8c2d.zip
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 4c7f2f53c..19bcb28fa 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -677,7 +677,20 @@ 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() + 1));
+
+ String line = text_editor->get_line(text_editor->cursor_get_line());
+
+ int positional_column = 0;
+
+ for (int i = 0; i < text_editor->cursor_get_column(); i++) {
+ if (line[i] == '\t') {
+ positional_column += text_editor->get_indent_size(); //tab size
+ } else {
+ positional_column += 1;
+ }
+ }
+
+ col_nb->set_text(itos(positional_column + 1));
}
void CodeTextEditor::_text_changed() {