Added stash/pop stash keybinding

This commit is contained in:
Abdelilah El Aissaoui 2024-08-21 11:56:23 +02:00
parent 761ea59986
commit cb705f29d1
No known key found for this signature in database
GPG Key ID: 7587FC860F594869
2 changed files with 24 additions and 0 deletions

View File

@ -57,6 +57,16 @@ enum class KeybindingOption {
* Used to show branch creation dialog
*/
BRANCH_CREATE,
/**
* Used to stash workspace changes
*/
STASH,
/**
* Used to pop stash changes to workspace
*/
STASH_POP,
}
@ -90,6 +100,12 @@ private fun baseKeybindings() = mapOf(
KeybindingOption.BRANCH_CREATE to listOf(
Keybinding(key = Key.B, control = true),
),
KeybindingOption.STASH to listOf(
Keybinding(key = Key.S, control = true),
),
KeybindingOption.STASH_POP to listOf(
Keybinding(key = Key.S, control = true, shift = true),
),
)
private fun linuxKeybindings(): Map<KeybindingOption, List<Keybinding>> = baseKeybindings()

View File

@ -128,6 +128,14 @@ fun RepositoryOpenPage(
false
}
}
it.matchesBinding(KeybindingOption.STASH) -> {
tabViewModel.stash()
true
}
it.matchesBinding(KeybindingOption.STASH_POP) -> {
tabViewModel.popStash()
true
}
else -> false
}