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

Ensure that scm.focus command works in all cases #131006

Open
eamodio opened this issue Aug 17, 2021 · 5 comments
Open

Ensure that scm.focus command works in all cases #131006

eamodio opened this issue Aug 17, 2021 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug scm General SCM compound issues
Milestone

Comments

@eamodio
Copy link
Contributor

eamodio commented Aug 17, 2021

Related to #119904

@eamodio eamodio added bug Issue identified by VS Code Team member as probable bug scm General SCM compound issues labels Aug 17, 2021
@eamodio eamodio added this to the August 2021 milestone Aug 17, 2021
@eamodio eamodio self-assigned this Aug 17, 2021
@eamodio eamodio modified the milestones: August 2021, September 2021 Aug 30, 2021
@ArturoDent
Copy link

FYI, in the Insiders Build with this keybinding:

{
  "key": "alt+e",
  "command": "workbench.scm.focus"
}

focus does indeed go to the commit message input box. Unless say a file in the scm view previously had focus - as in click a file to open its scm diff editor. Then the above keybinding goes back to that file and not the message box.

I assume this is expected behaviour?


Version: 1.61.0-insider (user setup)
Commit: df115e7
Date: 2021-09-08T17:51:26.439Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

@yellowtailfan
Copy link

yellowtailfan commented Sep 9, 2021

The way it used to work (A): I could press Ctrl-Alt-G at any time, and VS Code would always focus the commit message box, and I could immediately start typing a commit message and then Ctrl-Enter to commit.

Since about 3 months ago, VS Code has a different behaviour (B): when I press Ctrl-Alt-G, then sometimes VS Code focuses the commit message and sometimes it focuses one of the changed files in the Git pane. If it focuses on a changed file, then it's not clear how to use the keyboard to move the focus to the commit message.

Having a keyboard shortcut that always goes directly to the commit message is very useful, so I much prefer (A) than (B).

But at least thanks to @ArturoDent I can understand why it sometimes does what I want and sometimes not.

@ArturoDent
Copy link

ArturoDent commented Sep 9, 2021

@yellowtailfan It appears that from a focused file in the scm view you can Home and then Enter to focus the commit message box.

I suppose you could make a macro with workbench.scm.focus and then list.focusFirst and then list.select that would always focus the message box whether a file was previously focused or not:

{
  "key": "alt+z",
  "command": "extension.multiCommand.execute",  // using the multi-command macro extension
  "args": {
    "sequence": [
      "workbench.scm.focus",
      "list.focusFirst",
      "list.select"
    ]
  },
  "when": "editorTextFocus"
},

This actually works quite nicely.

@yellowtailfan
Copy link

Wow thank you for creating a macro, that looks quite handy.

I was also inspired to experiment a bit before I saw your reply, and I found that pressing Home and then Tab also works. Plus using Tab and the arrow keys I can move between the commit message and the changed files list, and press Enter on a changed file to see the diff.

@starball5
Copy link

Also related: #44602.

I wrote up an improved version of ArturoDent's solution, which can be found here (and here. two different (different constraint levels) but very similar questions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug scm General SCM compound issues
Projects
None yet
Development

No branches or pull requests

5 participants