Skip to content

When the input panel is closed by enter the hide_panel command is not called #1827

@evandrocoan

Description

@evandrocoan

Actual behavior

The hide_panel event is not called by the enter key, when it is pressed on the current panel, causing it to close.

Steps to reproduce

  1. Create the package bug.py on your User folder.

    import sublime, sublime_plugin
    
    class HidePanelBugListener(sublime_plugin.EventListener):
    
        def on_post_window_command(self, window, command, args):
    
            if command == "hide_panel":
                print( "on_post_window_command hide_panel" )
    
    def on_cancel():
        print( "Cancelling" )
        pass
    
    def on_done(self):
        print( "Done" )
    
    
    def on_change(self):
        print( "Change" )
        pass
    
    class HidePanelBugCommand(sublime_plugin.WindowCommand):
    
        def run(self):
            sublime.active_window().show_input_panel( \
                       "To bug it, press enter: ", "", on_done, on_change, on_cancel )
  2. Open Sublime Text console Ctrl+' and run the command
    sublime.active_window().run_command( "hide_panel_bug" )

  3. If you press enter, you will get the output:

    >>> sublime.active_window().run_command( "hide_panel_bug" )
    Change
    Done
    
  4. If you press escape, you will get the output:

    >>> sublime.active_window().run_command( "hide_panel_bug" )
    Change
    on_post_window_command hide_panel
    Cancelling
    

Expected behavior

When I open the input panel I am expecting to receive the hide_panel event when it is closed, either by the escape key, either by the enter key.

  1. If you press enter, you will get the output:

    >>> sublime.active_window().run_command( "hide_panel_bug" )
    Change
    on_post_window_command hide_panel
    Done
    
  2. If you press escape, you will get the output:

    >>> sublime.active_window().run_command( "hide_panel_bug" )
    Change
    on_post_window_command hide_panel
    Cancelling
    

Environment

  • Operating system and version:
    • Windows 10 build 15063
    • Mac OS ...
    • Linux ...
  • Monitor:
    • Resolution 1920x1080
    • dpi_scale used in ST 1.0
  • Sublime Text:
    • Build 3141
    • 32 bit

Related issues:

  1. Input panel closes when completions visible and press enter #1727 Input panel closes when completions visible and press enter

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions