MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _line_col_changed

Method _line_col_changed

editor/gui/code_editor.cpp:979–1009  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

977}
978
979void CodeTextEditor::_line_col_changed() {
980 if (!code_complete_timer->is_stopped() && code_complete_timer_line != text_editor->get_caret_line()) {
981 code_complete_timer->stop();
982 }
983
984 String line = text_editor->get_line(text_editor->get_caret_line());
985
986 int positional_column = 0;
987 for (int i = 0; i < text_editor->get_caret_column(); i++) {
988 if (line[i] == '\t') {
989 positional_column += text_editor->get_indent_size(); // Tab size
990 } else {
991 positional_column += 1;
992 }
993 }
994
995 StringBuilder sb;
996 sb.append(itos(text_editor->get_caret_line() + 1).lpad(4));
997 sb.append(" : ");
998 sb.append(itos(positional_column + 1).lpad(3));
999
1000 line_and_col_txt->set_text(sb.as_string());
1001
1002 if (find_replace_bar) {
1003 if (!find_replace_bar->line_col_changed_for_result) {
1004 find_replace_bar->needs_to_count_results = true;
1005 }
1006
1007 find_replace_bar->line_col_changed_for_result = false;
1008 }
1009}
1010
1011void CodeTextEditor::_text_changed() {
1012 if (code_complete_enabled && text_editor->is_insert_text_operation()) {

Callers

nothing calls this directly

Calls 11

itosFunction · 0.85
is_stoppedMethod · 0.80
get_caret_lineMethod · 0.80
get_indent_sizeMethod · 0.80
lpadMethod · 0.80
stopMethod · 0.45
get_lineMethod · 0.45
get_caret_columnMethod · 0.45
appendMethod · 0.45
set_textMethod · 0.45
as_stringMethod · 0.45

Tested by

no test coverage detected