sublime_merge icon indicating copy to clipboard operation
sublime_merge copied to clipboard

Accidentally pressing CMD+S can irreversibly lose a long, detailed commit message.

Open taliesinb opened this issue 3 years ago • 3 comments

Problem description

I lost a long commit message that took half an hour to write when I accidentally pressed CMD+S (my subconscious Sublime Text way to "Save important work").

Preferred solution

Up to you.

Alternatives

A description of any alternative solutions or enhancements considered.

Screenshots

If applicable, add screenshots to help demonstrate the problem or proposed solution. This section may be omitted/removed.

taliesinb avatar Oct 03 '22 10:10 taliesinb

Hi @taliesinb,

Thanks for reaching out and sorry to hear you experienced this - this definitely sounds like a bug as this isn't expected behavior.

Could you confirm whether you were in the process of merging/cherry-picking/reverting commits? In the general case, git stash shouldn't result in the commit message being lost but I've managed to reproduce the issue in the above states.

Cheers, - Dylan from Sublime HQ

dpjohnst avatar Oct 10 '22 01:10 dpjohnst

I hit this problem all the time. As a regular user of sublime text, my motor memory expects the key binds in sublime merge to do the same thing and I'm constantly triggering stash by accident.

Alternative 1:

Rather than using a dropdown to select between "commit", "amend", and "amend without commit hooks", use a radio button to select between the actions and have a separate "commit" button to invoke the action. The cmd-s button can be bound to that commit button.

Alternative 2:

Have the "ctrl-s" button trigger an action that saves the edit buffer to disk, so that it can be recovered later if smerge is closed or killed.

Alternative 3:

Leave ctrl-s unbound in smerge and use some other default binding for stash.

sxenos avatar Oct 17 '22 16:10 sxenos

@sxenos, regarding alternative 3, a workaround is to add this keybinding:

Default.sublime-keymap:
[
    { "keys": ["super+s"], "command": "noop" },
]

srbs avatar Oct 23 '22 07:10 srbs