summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-03-19 08:45:21 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-03-19 21:42:21 +1100
commit8fbcc36331cb5ac7a61493ff185782d6233d4673 (patch)
tree5bd48d9cf71b46dfc1676054aaa6b8df1e5748e0
parentdadb6462523a545bb5256d7a3c08ffb341f980cc (diff)
allow resetting cherry picked commits selection
-rw-r--r--docs/Config.md1
-rw-r--r--pkg/config/app_config.go1
-rw-r--r--pkg/gui/commits_panel.go5
-rw-r--r--pkg/gui/keybindings.go8
-rw-r--r--pkg/i18n/english.go3
5 files changed, 18 insertions, 0 deletions
diff --git a/docs/Config.md b/docs/Config.md
index d28f39bf0..7cd142f69 100644
--- a/docs/Config.md
+++ b/docs/Config.md
@@ -128,6 +128,7 @@ Default path for the config file:
tagCommit: 'T'
toggleDiffCommit: 'i'
checkoutCommit: '<space>'
+ resetCherryPick: '<c-R>'
stash:
popStash: 'g'
commitFiles:
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go
index deb5a9bd3..eed4e7da4 100644
--- a/pkg/config/app_config.go
+++ b/pkg/config/app_config.go
@@ -360,6 +360,7 @@ keybinding:
tagCommit: 'T'
toggleDiffCommit: 'i'
checkoutCommit: '<space>'
+ resetCherryPick: '<c-R>'
stash:
popStash: 'g'
commitFiles:
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go
index 8baa5c9e5..a5e864dc9 100644
--- a/pkg/gui/commits_panel.go
+++ b/pkg/gui/commits_panel.go
@@ -642,3 +642,8 @@ func (gui *Gui) handleOpenSearchForCommitsPanel(g *gocui.Gui, v *gocui.View) err
return gui.handleOpenSearch(gui.g, v)
}
+
+func (gui *Gui) handleResetCherryPick(g *gocui.Gui, v *gocui.View) error {
+ gui.State.CherryPickedCommits = []*commands.Commit{}
+ return gui.refreshCommits(gui.g)
+}
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go
index 3f965f2f6..501f1faea 100644
--- a/pkg/gui/keybindings.go
+++ b/pkg/gui/keybindings.go
@@ -842,6 +842,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
},
{
ViewName: "commits",
+ Contexts: []string{"branch-commits"},
+ Key: gui.getKey("commits.resetCherryPick"),
+ Modifier: gocui.ModNone,
+ Handler: gui.handleResetCherryPick,
+ Description: gui.Tr.SLocalize("resetCherryPick"),
+ },
+ {
+ ViewName: "commits",
Contexts: []string{"reflog-commits"},
Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index c17cd753d..13f617264 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -1032,6 +1032,9 @@ func addEnglish(i18nObject *i18n.Bundle) error {
}, &i18n.Message{
ID: "closeMenu",
Other: "close menu",
+ }, &i18n.Message{
+ ID: "resetCherryPick",
+ Other: "reset cherry-picked (copied) commits selection",
},
)
}