diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-06 15:16:09 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-06 15:16:09 +0100 |
commit | 6dddc031e80efa901645e4509ea8a5fb4b762c22 (patch) | |
tree | f1ed2f9984bd771ee5ffd1e398fbe070581ef049 /editor | |
parent | 450e8e3c2fb3e64d5439b5e011f50b889ac343e9 (diff) | |
parent | 02f7e03a6632182b2765da61182e9912dd826cbe (diff) |
Merge pull request #69651 from alfredbaudisch/autocomplete-line-number
Cancels the code complete timer when the caret moves to another line
Diffstat (limited to 'editor')
-rw-r--r-- | editor/code_editor.cpp | 5 | ||||
-rw-r--r-- | editor/code_editor.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 926c01b334..7ae0db7b48 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -873,6 +873,10 @@ void CodeTextEditor::_reset_zoom() { } void CodeTextEditor::_line_col_changed() { + if (!code_complete_timer->is_stopped() && code_complete_timer_line != text_editor->get_caret_line()) { + code_complete_timer->stop(); + } + String line = text_editor->get_line(text_editor->get_caret_line()); int positional_column = 0; @@ -902,6 +906,7 @@ void CodeTextEditor::_line_col_changed() { void CodeTextEditor::_text_changed() { if (text_editor->is_insert_text_operation()) { + code_complete_timer_line = text_editor->get_caret_line(); code_complete_timer->start(); } diff --git a/editor/code_editor.h b/editor/code_editor.h index ded7518287..4d7034fbd0 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -158,6 +158,7 @@ class CodeTextEditor : public VBoxContainer { Label *info = nullptr; Timer *idle = nullptr; Timer *code_complete_timer = nullptr; + int code_complete_timer_line = 0; Timer *font_resize_timer = nullptr; int font_resize_val; |