Merge pull request #62675 from Jummit/tolerant_lookup

Allow drag-clicking before symbol lookup
This commit is contained in:
Rémi Verschelde 2022-12-03 21:30:57 +01:00
commit 82b1cd6753
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 4 additions and 2 deletions

View file

@ -378,12 +378,13 @@ void CodeEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
}
if (symbol_lookup_on_click_enabled) {
if (mm->is_command_or_control_pressed() && mm->get_button_mask() == MouseButton::NONE && !is_dragging_cursor()) {
if (mm->is_command_or_control_pressed() && mm->get_button_mask() == MouseButton::NONE) {
symbol_lookup_pos = get_line_column_at_pos(mpos);
symbol_lookup_new_word = get_word_at_pos(mpos);
if (symbol_lookup_new_word != symbol_lookup_word) {
emit_signal(SNAME("symbol_validate"), symbol_lookup_new_word);
}
} else {
} else if (!mm->is_command_or_control_pressed() || (mm->get_button_mask() != MouseButton::NONE && symbol_lookup_pos != get_line_column_at_pos(mpos))) {
set_symbol_lookup_word_as_valid(false);
}
}

View file

@ -236,6 +236,7 @@ private:
String symbol_lookup_new_word = "";
String symbol_lookup_word = "";
Point2i symbol_lookup_pos;
/* Visual */
Ref<StyleBox> style_normal;