sublime_merge icon indicating copy to clipboard operation
sublime_merge copied to clipboard

Cmd+Enter does not enter edit_commit mode

Open nk9 opened this issue 3 years ago • 1 comments

Version info

  • OS: macOS 12.6.1
  • Build: 2077

Description

When I select a commit in a repo which I have edit access to and then press Cmd+Return, nothing happens. When I begin editing the commit message using the context menu > Edit Commit > Edit Commit Message, I can stop editing and discard my changes using Escape. I can also save the commit message using Cmd+Return.

The default key bindings for OS X in the Sublime Merge package have these bindings, which I believe are relevant:

    { "keys": ["super+enter"], "command": "commit", "args": { "mode": "commit" },
        "context": [{ "key": "setting.commit_message" }, { "key": "can_commit" }]
    },
    { "keys": ["super+enter"], "command": "edit_commit",
        "context": [{ "key": "setting.commit_message" }, { "key": "read_only" }]
    },
    { "keys": ["super+enter"], "command": "save_commit_message",
        "context": [{ "key": "setting.commit_message" }, { "key": "is_editing_commit" }]
    },
    { "keys": ["escape"], "command": "cancel_edit_commit_message",
        "context": [{ "key": "setting.commit_message" }, { "key": "is_editing_commit" }]
    },

It appears that the first one isn't working. I don't understand what the second one is for. Maybe to allow selecting the text even in the case where you can't edit it?

I can enter commit mode as expected using this key binding:

    {
        "keys": ["super+enter"],
        "command": "edit_commit",
        "args": { "commit": "$commit" }
    },

But then Cmd+Return doesn't work to STOP editing and save the new commit message.

Steps to reproduce

Steps to reproduce the behavior:

  1. Open repository with edit access
  2. Select a commit
  3. Press Cmd+Return

Expected behavior

Given the default key bindings, I'd expect this to begin editing the commit message. Instead, nothing happens.

Other info I also discussed this on the Sublime Forum.

nk9 avatar Nov 19 '22 19:11 nk9

I have turned on logging by setting "log_commands": true. When I press Cmd+Return, I get this in the console:

no command for selector: noop:

I've found that a way to fix the bindings so that everything behaves as expected is to put this in my personal keymap:

    {
        "keys": ["super+enter"],
        "command": "edit_commit",
        "context": [{ "key": "setting.commit_message" },
                    { "key": "is_editing_commit", "operator": "not_equal" }]
    },

nk9 avatar Nov 19 '22 22:11 nk9

I have tried this on Windows and it doesn't work there either. When I turn on log_commands, open the console and press Ctrl+Enter on a commit, nothing happens.

nk9 avatar Dec 26 '22 12:12 nk9

Wondering if the new logging mentioned in #1659 will help diagnose this issue as well? @dpjohnst Behavior hasn't changed in build 2079.

https://user-images.githubusercontent.com/3646730/231153609-4c952c27-a532-4b07-a1bb-7d92dc354dee.mp4

nk9 avatar Apr 11 '23 11:04 nk9

Hi @nk9,

Thanks for sharing that video - currently the keybinding ctrl + enter will only work if the commit message has focus. You can use the tab key to switch focus in the GUI.

Could you confirm if the keybinding works when the commit message has focus?

As an aside, I can see the utility in allowing that keybinding to work when the commit in the graph has focus as well. I'll look into supporting this.

Thanks, - Dylan from Sublime HQ

dpjohnst avatar Apr 12 '23 04:04 dpjohnst

Oh, interesting. Indeed, if you press Tab and then Cmd+Enter, then it works. Thanks for explaining. Of course, as soon as you cancel or commit the change, focus moves back to the graph and you have to use Tab one more time before you can use the shortcut again.

So I guess this is an enhancement request. But I'm really hopeful it's something that's possible to change soonish!

nk9 avatar Apr 12 '23 13:04 nk9