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 focusing the main view #3988

Open
stefanhaller opened this issue Oct 12, 2024 · 0 comments
Open

Allow focusing the main view #3988

stefanhaller opened this issue Oct 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@stefanhaller
Copy link
Collaborator

Currently the main view can't be focused. It can be scrolled with pgup/pgdn or with c-d/c-u, but that's very non-standard and hard to discover. Also, it goes only line by line; it would be useful to be able to scroll by pages.

It would be nice if there was a way to focus the main view, including having a selection that can be moved up/down like in all other views (up/down for line by line, ,/. by page, </> for beginning/end). This would also allow searching the main view.

And, together with #3986, it would make it possible to select a line in the main view, and then either hit e to edit the file at that line, or enter to go to the staging view.

Challenges/open questions:

  • Clicking in the main view. Right now, clicking in the diff of a commit does nothing, so this can easily focus the main view and select the clicked line. However, if a file is selected in the files panel, then clicking in the diff currently enters staging (with all the caveats mentioned in Improve clicking in diff view to enter staging/patch building #3986), so selecting the line would be a behavior change that might be annoying for existing users; you'd need an extra enter key press to enter staging.
  • Focusing the main view with the keyboard. This needs a new key, since enter is already taken. Maybe 0 would make sense (in analogy to 1-5 for the side panels).
    • One detail consideration: which line do we select when hitting the key? Users might already have scrolled with the wheel, in which case it would be annoying to select the first line (and jump back to the top). Maybe we should always select the line that is in the middle of the screen?
  • Hitting escape to go "out". In some cases it will be possible to jump from the main view to another view, e.g. from a diff to the staging view. When hitting escape, should we put the focus back to the main view that we came from, or focus the side panel like we do today? I suppose the latter would be easier to implement, since we may have to rerender the main view after coming back from staging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant