gitui-org / gitui-org/gitui

Official vim-style config: Shift+U conflict can cause accidental commit undo

Aperta
#2,704 2 commenti 3 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Rust
Stelle
22.5k
Fork
773
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Describe the bug**
Using the official vim-style key config (https://github.com/gitui-org/gitui/blob/master/vim_style_key_config.ron) directly causes a keybinding conflict.
`Shift+U` is defined as `reset` in the config file, but GitUI also keeps its default binding for `undo_commit`.

As a result:
- In *Unstaged Changes*, `Shift+U` works as `reset` (expected).
- In *Staged Changes*, the same key instead triggers `undo last commit`.

Both actions show similar confirmation prompts, which makes it easy to mistake one for the other and accidentally undo a commit.

As a user, I’m not sure whether mapping the same key to different actions in *Unstaged* vs *Staged* windows is intended design, but I did make this mistake multiple times in real use.

**To Reproduce**
1. Use the official `vim_style_key_config.ron` without modification
2. Go to `Unstaged Changes` → press `Shift+U` → file reset (expected)
3. Go to `Staged Changes` → press `Shift+U` → undo last commit (unexpected)

**Expected behavior**
When using the official config, `Shift+U` should only perform `reset`.
`undo_commit` should be reassigned to another key to avoid conflict.

**Screenshots**
N/A

**Context (please complete the following information):**
- OS/Distro + Version: Windows 10
- GitUI Version: 0.27.0 (99f6967) 2025-01-14
- Rust version: cargo 1.89.0 (c24e10642 2025-06-23)

**Additional context**
This issue happens specifically because the *officially provided config file* conflicts with default keybindings.
A simple workaround is to explicitly rebind `undo_commit` to another key in the config, e.g.:
```
undo_commit: Some(( code: Char('_'), modifiers: "SHIFT")),
```
This avoids the conflict while keeping `Shift+U` for `reset`.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con vim_style_key_config.ron e le definizioni predefinite delle associazioni dei tasti, quindi traccia come viene risolto Shift+U nelle viste Unstaged Changes e Staged Changes. Verifica che la configurazione ufficiale non lasci più undo_commit sul tasto in conflitto e riproduci entrambi i percorsi dei tasti per confermare che reset rimanga disponibile senza attivare l'annullamento del commit.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, rust
Ambito
cli
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
52/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.