Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* crash when opening submodule ([#2895](https://github.com/gitui-org/gitui/issues/2895))
* when staging the last file in a directory, the first item after the directory is no longer skipped [[@Tillerino](https://github.com/Tillerino)] ([#2748](https://github.com/gitui-org/gitui/issues/2748))
* index-out-of-bounds panic when unstaging lines near the end of a diff ([#2953](https://github.com/gitui-org/gitui/issues/2953))
* key hints now show every modifier of a binding such as `ctrl+shift` instead of dropping them

## [0.28.1] - 2026-03-21

Expand Down
39 changes: 29 additions & 10 deletions src/keys/key_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,21 @@ impl KeyConfig {
u
)
}
KeyCode::Null => {
self.get_modifier_hint(ev.modifiers).into()
}
KeyCode::Null => self.get_modifier_hint(ev.modifiers),
_ => String::new(),
}
}

fn get_modifier_hint(&self, modifier: KeyModifiers) -> &str {
match modifier {
KeyModifiers::CONTROL => &self.symbols.control,
KeyModifiers::SHIFT => &self.symbols.shift,
KeyModifiers::ALT => &self.symbols.alt,
_ => "",
}
fn get_modifier_hint(&self, modifier: KeyModifiers) -> String {
[
(KeyModifiers::CONTROL, &self.symbols.control),
(KeyModifiers::SHIFT, &self.symbols.shift),
(KeyModifiers::ALT, &self.symbols.alt),
]
.into_iter()
.filter(|(flag, _)| modifier.contains(*flag))
.map(|(_, symbol)| symbol.as_str())
.collect()
}
}

Expand All @@ -145,6 +146,24 @@ mod tests {
assert_eq!(h, "^c");
}

#[test]
fn test_get_hint_combined_modifiers() {
let config = KeyConfig::default();
let h = config.get_hint(GituiKeyEvent::new(
KeyCode::Char('c'),
KeyModifiers::CONTROL | KeyModifiers::SHIFT,
));
assert_eq!(h, "^\u{21e7}c");

let h = config.get_hint(GituiKeyEvent::new(
KeyCode::Up,
KeyModifiers::CONTROL
| KeyModifiers::SHIFT
| KeyModifiers::ALT,
));
assert_eq!(h, "^\u{21e7}\u{2325}\u{2191}");
}

#[test]
fn test_symbolic_links() {
let app_home = get_app_config_path().unwrap();
Expand Down