Skip to content

feat: stage, unstage, discard and go from file to file by keys, and clone or create from the palette - #59

Merged
Lars- merged 1 commit into
mainfrom
feat/view-shortcuts
Nov 21, 2026
Merged

Lars- merged 1 commit into
mainfrom
feat/view-shortcuts

Conversation

@Lars-

@Lars- Lars- commented Nov 21, 2026

Copy link
Copy Markdown
Owner

What this changes

With a diff in view, the keyboard now does what its buttons and the panel on the right do:

Stage, unstage Ctrl+S, Ctrl+U
Discard (asks first) Ctrl+Backspace
Next and previous file Ctrl+Down, Ctrl+Up
Back to the graph Escape (as before, now also in the palette)

Stage, unstage and discard act on the lines you picked, or on the whole file while you picked none, so an untracked file can be staged or deleted from its diff too. Next and previous go through the files in the order of the panel on the right: the unstaged and then the staged changes (conflicted files open to be resolved, so they are skipped), or the files of the selected commit. With no file in view, Ctrl+Down opens the first one, so from the graph you can pick a commit with the arrows and step through its files.

Once a file in the working tree has nothing left on its side, as when you stage it, the next file of that list takes its place instead of an empty "No changes" diff; when there is none, the diff closes. That makes going through the changes and staging them one by one a matter of reading and pressing Ctrl+S.

The palette also lists these, by name ("Stage file", "Stage 2 lines", "Discard file…", "Next file", "Back to the graph"), and the start screen's "Clone a repository…" and "Create a repository…", which open its dialog from any tab. The buttons that stage or discard picked lines show their key in a tooltip.

Next and previous file are not on Alt and the arrows: labwc, and other window managers, move the window with those.

How it is built:

  • diff::commands names what can be done with the file in view, by the same verbs as the buttons; details::discard now takes the diff it is about, so the panel and the keyboard ask the same question.
  • Workspace::changes lists the changed files with their diffs, once, for the panel, for next and previous (Workspace::listed) and for finding the file that takes the place of one with no changes left (Workspace::reread, out of poll).
  • The start screen's buttons now push Action::NewRepo, like the palette.
  • Escape stays with the views, which know whether it leaves a text field first; the palette only shows it.

This is part 2 of "Keyboard", the last part, on the roadmap.

How it is tested

  • stage_unstage_and_discard_the_file_in_view_by_keys: with two changed files and an untracked one, Ctrl+Down and Ctrl+Up go through them in the panel's order; Ctrl+S stages the file in view and the next one takes its place; with a line picked (clicked), Ctrl+S stages only that line and the file stays; Ctrl+Backspace asks before it discards; staging the untracked file leaves nothing unstaged and the diff closes; Ctrl+U unstages a staged file and the next staged one shows. It fails without the next file taking the place.

  • the_keyboard_goes_through_a_commit_s_files_and_back_to_the_graph: Ctrl+Down from the graph opens the selected commit's first file and stops at the last; a commit's file has nothing to stage in the palette and "Previous file" is off on the first; "Back to the graph" from the palette; "clone" and "create" open their dialogs on the start screen.

  • The rebase and search tests still pass, and fail when the keyboard takes Escape from the views (checked).

  • On the desktop (labwc): stepping through four changed files, staging a file and a single line, the discard question, the palette with its shortcuts, clone from a repository tab, and a commit's files.

  • cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace pass

  • It adds as little code as the change needs, and removes what it makes unnecessary

  • Nothing in it comes from GitKraken or another closed-source client (see CONTRIBUTING.md)

@Lars-
Lars- merged commit b8691c7 into main Nov 21, 2026
7 checks passed
@Lars-
Lars- deleted the feat/view-shortcuts branch November 21, 2026 10:22
@Lars- Lars- mentioned this pull request Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant