@@ -1637,6 +1637,7 @@ void TextEdit::_notification(int p_what) {
1637
1637
}
1638
1638
1639
1639
if (has_ime_text () && has_selection ()) {
1640
+ set_selection_mode (SELECTION_MODE_NONE);
1640
1641
delete_selection ();
1641
1642
}
1642
1643
@@ -1965,6 +1966,7 @@ void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
1965
1966
_reset_caret_blink_timer ();
1966
1967
apply_ime ();
1967
1968
_cancel_drag_and_drop_text ();
1969
+ set_selection_mode (SELECTION_MODE_NONE);
1968
1970
1969
1971
Point2i pos = get_line_column_at_pos (mpos);
1970
1972
int mouse_line = pos.y ;
@@ -4743,6 +4745,8 @@ void TextEdit::add_caret_at_carets(bool p_below) {
4743
4745
}
4744
4746
const int last_line_max_wrap = get_line_wrap_count (text.size () - 1 );
4745
4747
4748
+ set_selection_mode (SELECTION_MODE_NONE);
4749
+
4746
4750
begin_multicaret_edit ();
4747
4751
int view_target_caret = -1 ;
4748
4752
int view_line = p_below ? -1 : INT_MAX;
@@ -5289,6 +5293,8 @@ void TextEdit::select_word_under_caret(int p_caret) {
5289
5293
return ;
5290
5294
}
5291
5295
5296
+ set_selection_mode (SELECTION_MODE_NONE);
5297
+
5292
5298
for (int c = 0 ; c < carets.size (); c++) {
5293
5299
if (p_caret != -1 && p_caret != c) {
5294
5300
continue ;
@@ -5342,6 +5348,8 @@ void TextEdit::add_selection_for_next_occurrence() {
5342
5348
return ;
5343
5349
}
5344
5350
5351
+ set_selection_mode (SELECTION_MODE_NONE);
5352
+
5345
5353
const String &highlighted_text = get_selected_text (caret);
5346
5354
int column = get_selection_from_column (caret) + 1 ;
5347
5355
int line = get_selection_from_line (caret);
@@ -5373,6 +5381,8 @@ void TextEdit::skip_selection_for_next_occurrence() {
5373
5381
return ;
5374
5382
}
5375
5383
5384
+ set_selection_mode (SELECTION_MODE_NONE);
5385
+
5376
5386
// Always use the last caret, to correctly search for
5377
5387
// the next occurrence that comes after this caret.
5378
5388
int caret = get_caret_count () - 1 ;
@@ -5916,6 +5926,9 @@ void TextEdit::set_line_as_first_visible(int p_line, int p_wrap_index) {
5916
5926
ERR_FAIL_COND (p_wrap_index < 0 );
5917
5927
ERR_FAIL_COND (p_wrap_index > get_line_wrap_count (p_line));
5918
5928
set_v_scroll (get_scroll_pos_for_line (p_line, p_wrap_index));
5929
+
5930
+ scrolling = false ;
5931
+ minimap_clicked = false ;
5919
5932
}
5920
5933
5921
5934
int TextEdit::get_first_visible_line () const {
@@ -5927,6 +5940,9 @@ void TextEdit::set_line_as_center_visible(int p_line, int p_wrap_index) {
5927
5940
ERR_FAIL_COND (p_wrap_index < 0 );
5928
5941
ERR_FAIL_COND (p_wrap_index > get_line_wrap_count (p_line));
5929
5942
5943
+ scrolling = false ;
5944
+ minimap_clicked = false ;
5945
+
5930
5946
int visible_rows = get_visible_line_count ();
5931
5947
Point2i next_line = get_next_visible_line_index_offset_from (p_line, p_wrap_index, (-visible_rows / 2 ) - 1 );
5932
5948
int first_line = p_line - next_line.x + 1 ;
@@ -5943,6 +5959,9 @@ void TextEdit::set_line_as_last_visible(int p_line, int p_wrap_index) {
5943
5959
ERR_FAIL_COND (p_wrap_index < 0 );
5944
5960
ERR_FAIL_COND (p_wrap_index > get_line_wrap_count (p_line));
5945
5961
5962
+ scrolling = false ;
5963
+ minimap_clicked = false ;
5964
+
5946
5965
Point2i next_line = get_next_visible_line_index_offset_from (p_line, p_wrap_index, -get_visible_line_count () - 1 );
5947
5966
int first_line = p_line - next_line.x + 1 ;
5948
5967
@@ -6005,8 +6024,6 @@ void TextEdit::adjust_viewport_to_caret(int p_caret) {
6005
6024
ERR_FAIL_INDEX (p_caret, carets.size ());
6006
6025
6007
6026
// Move viewport so the caret is visible on the screen vertically.
6008
- scrolling = false ;
6009
- minimap_clicked = false ;
6010
6027
6011
6028
int cur_line = get_caret_line (p_caret);
6012
6029
int cur_wrap = get_caret_wrap_index (p_caret);
@@ -7699,7 +7716,7 @@ void TextEdit::_selection_changed(int p_caret) {
7699
7716
7700
7717
void TextEdit::_click_selection_held () {
7701
7718
// Update the selection mode on a timer so it is updated when the view scrolls even if the mouse isn't moving.
7702
- if (!Input::get_singleton ()->is_mouse_button_pressed (MouseButton::LEFT) || get_selection_mode () == SelectionMode::SELECTION_MODE_NONE ) {
7719
+ if (!Input::get_singleton ()->is_mouse_button_pressed (MouseButton::LEFT)) {
7703
7720
click_select_held->stop ();
7704
7721
return ;
7705
7722
}
@@ -7714,6 +7731,7 @@ void TextEdit::_click_selection_held() {
7714
7731
_update_selection_mode_line ();
7715
7732
} break ;
7716
7733
default : {
7734
+ click_select_held->stop ();
7717
7735
break ;
7718
7736
}
7719
7737
}
0 commit comments