Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the "Delete Line" shortcut to repeat/echo #28427

Closed
mitchcurtis opened this issue Apr 25, 2019 · 3 comments · Fixed by #36284
Closed

Allow the "Delete Line" shortcut to repeat/echo #28427

mitchcurtis opened this issue Apr 25, 2019 · 3 comments · Fixed by #36284

Comments

@mitchcurtis
Copy link
Contributor

Currently if you press and hold it, it will only delete one line and then do nothing.

@mitchcurtis
Copy link
Contributor Author

mitchcurtis commented Apr 28, 2019

I see that the delete_lines() function is called via this stack trace:

1  CodeTextEditor::delete_lines()                                                                                                                                  code_editor.cpp                        1024 0x101166f63    
2  ScriptTextEditor::_edit_option(int)                                                                                                                             script_text_editor.cpp                 940  0x101a91db0    
3  MethodBind1<int>::call(Object *, Variant const * *, int, Variant::CallError&)                                                                                   method_bind.gen.inc                    729  0x103063211    
4  Object::call(StringName const&, Variant const * *, int, Variant::CallError&)                                                                                    object.cpp                             942  0x102e8f202    
5  Object::emit_signal(StringName const&, Variant const * *, int)                                                                                                  object.cpp                             1228 0x102e917bb    
6  Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&)                                          object.cpp                             1284 0x102e8f898    
7  PopupMenu::activate_item(int)                                                                                                                                   popup_menu.cpp                         1102 0x101ede3fd    
8  PopupMenu::activate_item_by_event(Ref<InputEvent> const&, bool)                                                                                                 popup_menu.cpp                         1035 0x101ee7232    
9  MenuButton::_unhandled_key_input(Ref<InputEvent>)                                                                                                               menu_button.cpp                        47   0x101ec396d    
10 MethodBind1<Ref<InputEvent>>::call(Object *, Variant const * *, int, Variant::CallError&)                                                                       method_bind.gen.inc                    729  0x101dae8cb    
11 Object::call_multilevel(StringName const&, Variant const * *, int)                                                                                              object.cpp                             777  0x102e8d77c    
12 SceneTree::_call_input_pause(StringName const&, StringName const&, Ref<InputEvent> const&)                                                                      scene_tree.cpp                         931  0x101d3af2f    
13 Viewport::unhandled_input(Ref<InputEvent> const&)                                                                                                               viewport.cpp                           2698 0x101d71896    
14 Viewport::_vp_unhandled_input(Ref<InputEvent> const&)                                                                                                           viewport.cpp                           1341 0x101d71717    
15 MethodBind1<Ref<InputEvent> const&>::call(Object *, Variant const * *, int, Variant::CallError&)                                                                method_bind.gen.inc                    729  0x103043fdb    
16 Object::call(StringName const&, Variant const * *, int, Variant::CallError&)                                                                                    object.cpp                             942  0x102e8f202    
17 Object::call(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&)                                                 object.cpp                             866  0x102e8eac4    
18 SceneTree::call_group_flags(unsigned int, StringName const&, StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) scene_tree.cpp                         262  0x101d34a59    
19 SceneTree::input_event(Ref<InputEvent> const&)                                                                                                                  scene_tree.cpp                         435  0x101d361d9    
20 InputDefault::_parse_input_event_impl(Ref<InputEvent> const&, bool)                                                                                             input_default.cpp                      442  0x100022d72    
21 InputDefault::parse_input_event(Ref<InputEvent> const&)                                                                                                         input_default.cpp                      259  0x10002115f    
22 InputDefault::flush_accumulated_events()                                                                                                                        input_default.cpp                      670  0x100024c05    
23 OS_OSX::process_events()                                                                                                                                        os_osx.mm                              2575 0x100010634    
24 OS_OSX::run()                                                                                                                                                   os_osx.mm                              2652 0x100010c1f    
25 main                                                                                                                                                            godot_main_osx.mm                      100  0x100018128    
26 start                                                                                                                                                           (x86_64) /usr/lib/system/libdyld.dylib      0x7fff5be673d5 
27 start                                                                                                                                                           (x86_64) /usr/lib/system/libdyld.dylib      0x7fff5be673d5 
                              

However, that's only called if the event isn't repeating:

void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) {
if (disable_shortcuts)
return;
if (p_event->is_pressed() && !p_event->is_echo() && (Object::cast_to<InputEventKey>(p_event.ptr()) || Object::cast_to<InputEventJoypadButton>(p_event.ptr()) || Object::cast_to<InputEventAction>(*p_event))) {
if (!get_parent() || !is_visible_in_tree() || is_disabled())
return;
bool global_only = (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this));
if (popup->activate_item_by_event(p_event, global_only))
accept_event();
}
}

I have no idea why this is being routed through a PopupMenu though...

@Anutrix
Copy link
Contributor

Anutrix commented Jul 4, 2019

Making the repeat/echo on hold shouldn't be much hard. I'll make PR if it is accepted behavior.
We should note that the current behavior is safer because chances of accidental deletion due to holding too long is zero.

@KoBeWi
Copy link
Member

KoBeWi commented Oct 17, 2019

Related to #27164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants