From 7be474bd83a0fc01e67e1cfd92f1ed9e098b3bee Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Fri, 2 Oct 2020 07:32:48 +1000 Subject: [PATCH] update keybindings --- docs/keybindings/Keybindings_en.md | 110 +++++++++++++---------------- docs/keybindings/Keybindings_nl.md | 110 +++++++++++++---------------- docs/keybindings/Keybindings_pl.md | 110 +++++++++++++---------------- pkg/gui/keybindings.go | 56 ++++++--------- pkg/gui/list_context.go | 20 +++--- pkg/i18n/dutch.go | 10 +-- pkg/i18n/english.go | 19 +++-- scripts/generate_cheatsheet.go | 46 +++++++++--- 8 files changed, 229 insertions(+), 252 deletions(-) diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index e28142755..93e16e306 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -17,14 +17,20 @@ _: prev screen mode :: execute custom command |: view scoping options - : open diff menu + W: open diff menu + ctrl+e: open diff menu -## Branches Panel +## List Panel Navigation
   ]: next tab
   [: previous tab
+  ,: previous page
+  .: next page
+  <: scroll to top
+  /: start search
+  >: scroll to bottom
 
## Branches Panel (Branches Tab) @@ -43,11 +49,7 @@ g: view reset options R: rename branch ctrl+o: copy branch name to clipboard - ,: previous page - .: next page - <: scroll to top - /: start search - >: scroll to bottom + enter: view commits ## Branches Panel (Remote Branches (in Remotes tab)) @@ -55,17 +57,13 @@
   esc: Return to remotes list
   g: view reset options
+  enter: view commits
   space: checkout
   n: new branch
   M: merge into currently checked out branch
   d: delete branch
   r: rebase checked-out branch onto this branch
   u: set as upstream of checked-out branch
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
 
## Branches Panel (Remotes Tab) @@ -75,11 +73,19 @@ n: add new remote d: remove remote e: edit remote - ,: previous page - .: next page - <: scroll to top - /: start search - >: scroll to bottom + + +## Branches Panel (Sub-commits) + +
+  enter: view commit's files
+  space: checkout commit
+  g: view reset options
+  n: new branch
+  c: copy commit (cherry-pick)
+  C: copy commit range (cherry-pick)
+  ctrl+r: reset cherry-picked (copied) commits selection
+  ctrl+o: copy commit SHA to clipboard
 
## Branches Panel (Tags Tab) @@ -90,38 +96,22 @@ P: push tag n: create tag g: view reset options - ,: previous page - .: next page - <: scroll to top - /: start search - >: scroll to bottom + enter: view commits ## Commit Files Panel
-  esc: go back
+  ctrl+o: copy the committed file name to the clipboard
   c: checkout file
   d: discard this commit's changes to this file
   o: open file
   e: edit file
   space: toggle file included in patch
   enter: enter file to add selected lines to the patch
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
 
-## Commits Panel - -
-  ]: next tab
-  [: previous tab
-
- -## Commits Panel (Commits Tab) +## Commits Panel (Commits)
   s: squash down
@@ -147,26 +137,21 @@
   n: create new branch off of commit
   T: tag commit
   ctrl+r: reset cherry-picked (copied) commits selection
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
 
## Commits Panel (Reflog Tab)
+  enter: view commit's files
   space: checkout commit
   g: view reset options
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
+  c: copy commit (cherry-pick)
+  C: copy commit range (cherry-pick)
+  ctrl+r: reset cherry-picked (copied) commits selection
+  ctrl+o: copy commit SHA to clipboard
 
-## Files Panel +## Files Panel (Files)
   c: commit changes
@@ -185,12 +170,21 @@
   D: view reset options
   enter: stage individual hunks/lines
   f: fetch
+  ctrl+o: copy the file name to the clipboard
   g: view upstream reset options
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
+
+ +## Files Panel (Submodules) + +
+  ctrl+o: copy submodule name to clipboard
+  enter: enter submodule
+  d: view reset and remove submodule options
+  u: update submodule
+  n: add new submodule
+  e: update submodule URL
+  i: initialize submodule
+  b: view bulk submodule options
 
## Main Panel (Merging) @@ -254,24 +248,16 @@
   esc: close menu
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
 
## Stash Panel
+  enter: view stash entry's files
   space: apply
   g: pop
   d: drop
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
+  n: new branch
 
## Status Panel diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md index 567bf4d25..f5d4cf0d9 100644 --- a/docs/keybindings/Keybindings_nl.md +++ b/docs/keybindings/Keybindings_nl.md @@ -17,14 +17,20 @@ _: vorige schermmode :: voor aangepast commando uit |: bekijk scoping opties - : open diff menu + W: open diff menu + ctrl+e: open diff menu -## Branches Paneel +## List Panel Navigation
   ]: volgende tab
   [: vorige tab
+  ,: vorige pagina
+  .: volgende pagina
+  <: scroll naar boven
+  /: start met zoekken
+  >: scroll naar beneden
 
## Branches Paneel (Branches Tab) @@ -43,11 +49,7 @@ g: bekijk reset opties R: hernoem branch ctrl+o: copieer branch name naar clipboard - ,: vorige pagina - .: volgende pagina - <: scroll naar boven - /: start met zoekken - >: scroll naar beneden + enter: view commits ## Branches Paneel (Remote Branches (in Remotes tab)) @@ -55,17 +57,13 @@
   esc: Ga terug naar remotes lijst
   g: bekijk reset opties
+  enter: view commits
   space: uitchecken
   n: nieuwe branch
   M: merge in met huidige checked out branch
   d: verwijder branch
   r: rebase branch
   u: stel in als upstream van uitgecheckte branch
-  ,: vorige pagina
-  .: volgende pagina
-  <: scroll naar boven
-  /: start met zoekken
-  >: scroll naar beneden
 
## Branches Paneel (Remotes Tab) @@ -75,11 +73,19 @@ n: voeg een nieuwe remote toe d: verwijder remote e: wijzig remote - ,: vorige pagina - .: volgende pagina - <: scroll naar boven - /: start met zoekken - >: scroll naar beneden + + +## Branches Paneel (Sub-commits) + +
+  enter: bekijk gecommite bestanden
+  space: checkout commit
+  g: bekijk reset opties
+  n: nieuwe branch
+  c: kopiëer commit (cherry-pick)
+  C: kopiëer commit reeks (cherry-pick)
+  ctrl+r: reset cherry-picked (gecopieerde) commits selectie
+  ctrl+o: copieer commit SHA naar clipboard
 
## Branches Paneel (Tags Tab) @@ -90,38 +96,22 @@ P: push tag n: creëer tag g: bekijk reset opties - ,: vorige pagina - .: volgende pagina - <: scroll naar boven - /: start met zoekken - >: scroll naar beneden + enter: view commits ## Commit bestanden Paneel
-  esc: ga terug
+  ctrl+o: kopieer de vastgelegde bestandsnaam naar het klembord
   c: bestand uitchecken
   d: uitsluit deze commit zijn veranderingen aan dit bestand
   o: open bestand
   e: verander bestand
   space: toggle bestand inbegrepen in patch
   enter: enter bestand to add selecteered lines to the patch
-  ,: vorige pagina
-  .: volgende pagina
-  <: scroll naar boven
-  /: start met zoekken
-  >: scroll naar beneden
 
-## Commits Paneel - -
-  ]: volgende tab
-  [: vorige tab
-
- -## Commits Paneel (Commits Tab) +## Commits Paneel (Commits)
   s: squash beneden
@@ -147,26 +137,21 @@
   n: create new branch off of commit
   T: tag commit
   ctrl+r: reset cherry-picked (gecopieerde) commits selectie
-  ,: vorige pagina
-  .: volgende pagina
-  <: scroll naar boven
-  /: start met zoekken
-  >: scroll naar beneden
 
## Commits Paneel (Reflog Tab)
+  enter: bekijk gecommite bestanden
   space: checkout commit
   g: bekijk reset opties
-  ,: vorige pagina
-  .: volgende pagina
-  <: scroll naar boven
-  /: start met zoekken
-  >: scroll naar beneden
+  c: kopiëer commit (cherry-pick)
+  C: kopiëer commit reeks (cherry-pick)
+  ctrl+r: reset cherry-picked (gecopieerde) commits selectie
+  ctrl+o: copieer commit SHA naar clipboard
 
-## Bestanden Paneel +## Bestanden Paneel (Bestanden)
   c: Commit veranderingen
@@ -185,12 +170,21 @@
   D: bekijk reset opties
   enter: stage individuele hunks/lijnen
   f: fetch
+  ctrl+o: kopieer de bestandsnaam naar het klembord
   g: bekijk upstream reset opties
-  ,: vorige pagina
-  .: volgende pagina
-  <: scroll naar boven
-  /: start met zoekken
-  >: scroll naar beneden
+
+ +## Bestanden Paneel (Submodules) + +
+  ctrl+o: copy submodule name to clipboard
+  enter: enter submodule
+  d: view reset and remove submodule options
+  u: update submodule
+  n: add new submodule
+  e: update submodule URL
+  i: initialize submodule
+  b: view bulk submodule options
 
## Hooft Paneel (Merggen) @@ -254,24 +248,16 @@
   esc: sluit menu
-  ,: vorige pagina
-  .: volgende pagina
-  <: scroll naar boven
-  /: start met zoekken
-  >: scroll naar beneden
 
## Stash Paneel
+  enter: view stash entry's files
   space: toepassen
   g: pop
   d: laten vallen
-  ,: vorige pagina
-  .: volgende pagina
-  <: scroll naar boven
-  /: start met zoekken
-  >: scroll naar beneden
+  n: nieuwe branch
 
## Status Paneel diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md index bc288f107..cf936c9f4 100644 --- a/docs/keybindings/Keybindings_pl.md +++ b/docs/keybindings/Keybindings_pl.md @@ -17,14 +17,20 @@ _: prev screen mode :: execute custom command |: view scoping options - : open diff menu + W: open diff menu + ctrl+e: open diff menu -## Gałęzie Panel +## List Panel Navigation
   ]: next tab
   [: previous tab
+  ,: previous page
+  .: next page
+  <: scroll to top
+  /: start search
+  >: scroll to bottom
 
## Gałęzie Panel (Branches Tab) @@ -43,11 +49,7 @@ g: view reset options R: rename branch ctrl+o: copy branch name to clipboard - ,: previous page - .: next page - <: scroll to top - /: start search - >: scroll to bottom + enter: view commits ## Gałęzie Panel (Remote Branches (in Remotes tab)) @@ -55,17 +57,13 @@
   esc: return to remotes list
   g: view reset options
+  enter: view commits
   space: przełącz
   n: nowa gałąź
   M: scal do obecnej gałęzi
   d: usuń gałąź
   r: rebase branch
   u: set as upstream of checked-out branch
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
 
## Gałęzie Panel (Remotes Tab) @@ -75,11 +73,19 @@ n: add new remote d: remove remote e: edit remote - ,: previous page - .: next page - <: scroll to top - /: start search - >: scroll to bottom + + +## Gałęzie Panel (Sub-commits) + +
+  enter: view commit's files
+  space: checkout commit
+  g: view reset options
+  n: nowa gałąź
+  c: copy commit (cherry-pick)
+  C: copy commit range (cherry-pick)
+  ctrl+r: reset cherry-picked (copied) commits selection
+  ctrl+o: copy commit SHA to clipboard
 
## Gałęzie Panel (Tags Tab) @@ -90,38 +96,22 @@ P: push tag n: create tag g: view reset options - ,: previous page - .: next page - <: scroll to top - /: start search - >: scroll to bottom + enter: view commits ## Commit files Panel
-  esc: go back
+  ctrl+o: copy the committed file name to the clipboard
   c: checkout file
   d: discard this commit's changes to this file
   o: otwórz plik
   e: edytuj plik
   space: toggle file included in patch
   enter: enter file to add selected lines to the patch
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
 
-## Commity Panel - -
-  ]: next tab
-  [: previous tab
-
- -## Commity Panel (Commits Tab) +## Commity Panel (Commity)
   s: ściśnij w dół
@@ -147,26 +137,21 @@
   n: create new branch off of commit
   T: tag commit
   ctrl+r: reset cherry-picked (copied) commits selection
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
 
## Commity Panel (Reflog Tab)
+  enter: view commit's files
   space: checkout commit
   g: view reset options
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
+  c: copy commit (cherry-pick)
+  C: copy commit range (cherry-pick)
+  ctrl+r: reset cherry-picked (copied) commits selection
+  ctrl+o: copy commit SHA to clipboard
 
-## Pliki Panel +## Pliki Panel (Pliki)
   c: commituj zmiany
@@ -185,12 +170,21 @@
   D: view reset options
   enter: zatwierdź pojedyncze linie
   f: fetch
+  ctrl+o: copy the file name to the clipboard
   g: view upstream reset options
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
+
+ +## Pliki Panel (Submodules) + +
+  ctrl+o: copy submodule name to clipboard
+  enter: enter submodule
+  d: view reset and remove submodule options
+  u: update submodule
+  n: add new submodule
+  e: update submodule URL
+  i: initialize submodule
+  b: view bulk submodule options
 
## Main Panel (Merging) @@ -254,24 +248,16 @@
   esc: close menu
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
 
## Schowek Panel
+  enter: view stash entry's files
   space: zastosuj
   g: wyciągnij
   d: porzuć
-  ,: previous page
-  .: next page
-  <: scroll to top
-  /: start search
-  >: scroll to bottom
+  n: nowa gałąź
 
## Status Panel diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 97b720b49..40f15ba56 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -21,6 +21,7 @@ type Binding struct { Modifier gocui.Modifier Description string Alternative string + Tag string // e.g. 'navigation'. Used for grouping things in the cheatsheet } // GetDisplayStrings returns the display string of a file @@ -633,18 +634,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Handler: gui.wrappedHandler(gui.handleSwitchToSubCommits), Description: gui.Tr.SLocalize("viewCommits"), }, - { - ViewName: "branches", - Key: gui.getKey("universal.nextTab"), - Handler: gui.handleNextTab, - Description: gui.Tr.SLocalize("nextTab"), - }, - { - ViewName: "branches", - Key: gui.getKey("universal.prevTab"), - Handler: gui.handlePrevTab, - Description: gui.Tr.SLocalize("prevTab"), - }, { ViewName: "branches", Contexts: []string{REMOTE_BRANCHES_CONTEXT_KEY}, @@ -673,18 +662,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Handler: gui.handleFetchRemote, Description: gui.Tr.SLocalize("fetchRemote"), }, - { - ViewName: "commits", - Key: gui.getKey("universal.nextTab"), - Handler: gui.handleNextTab, - Description: gui.Tr.SLocalize("nextTab"), - }, - { - ViewName: "commits", - Key: gui.getKey("universal.prevTab"), - Handler: gui.handlePrevTab, - Description: gui.Tr.SLocalize("prevTab"), - }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, @@ -1560,18 +1537,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Modifier: gocui.ModNone, Handler: gui.wrappedHandler(gui.onMenuPress), }, - { - ViewName: "files", - Key: gui.getKey("universal.nextTab"), - Handler: gui.handleNextTab, - Description: gui.Tr.SLocalize("nextTab"), - }, - { - ViewName: "files", - Key: gui.getKey("universal.prevTab"), - Handler: gui.handlePrevTab, - Description: gui.Tr.SLocalize("prevTab"), - }, { ViewName: "files", Contexts: []string{SUBMODULES_CONTEXT_KEY}, @@ -1644,6 +1609,25 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { bindings = append(bindings, &Binding{ViewName: "", Key: rune(i+1) + '0', Modifier: gocui.ModNone, Handler: gui.goToSideWindow(window)}) } + for viewName := range gui.viewTabContextMap() { + bindings = append(bindings, []*Binding{ + { + ViewName: viewName, + Key: gui.getKey("universal.nextTab"), + Handler: gui.handleNextTab, + Description: gui.Tr.SLocalize("nextTab"), + Tag: "navigation", + }, + { + ViewName: viewName, + Key: gui.getKey("universal.prevTab"), + Handler: gui.handlePrevTab, + Description: gui.Tr.SLocalize("prevTab"), + Tag: "navigation", + }, + }...) + } + bindings = append(bindings, gui.getListContextKeyBindings()...) return bindings diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go index 0edd80873..3e5bf8467 100644 --- a/pkg/gui/list_context.go +++ b/pkg/gui/list_context.go @@ -510,15 +510,15 @@ func (gui *Gui) getListContextKeyBindings() []*Binding { for _, listContext := range gui.getListContexts() { bindings = append(bindings, []*Binding{ - {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevItem-alt"), Modifier: gocui.ModNone, Handler: listContext.handlePrevLine}, - {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevItem"), Modifier: gocui.ModNone, Handler: listContext.handlePrevLine}, - {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gocui.MouseWheelUp, Modifier: gocui.ModNone, Handler: listContext.handlePrevLine}, - {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextItem-alt"), Modifier: gocui.ModNone, Handler: listContext.handleNextLine}, - {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextItem"), Modifier: gocui.ModNone, Handler: listContext.handleNextLine}, - {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevPage"), Modifier: gocui.ModNone, Handler: listContext.handlePrevPage, Description: gui.Tr.SLocalize("prevPage")}, - {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextPage"), Modifier: gocui.ModNone, Handler: listContext.handleNextPage, Description: gui.Tr.SLocalize("nextPage")}, - {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.gotoTop"), Modifier: gocui.ModNone, Handler: listContext.handleGotoTop, Description: gui.Tr.SLocalize("gotoTop")}, - {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gocui.MouseWheelDown, Modifier: gocui.ModNone, Handler: listContext.handleNextLine}, + {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevItem-alt"), Modifier: gocui.ModNone, Handler: listContext.handlePrevLine}, + {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevItem"), Modifier: gocui.ModNone, Handler: listContext.handlePrevLine}, + {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gocui.MouseWheelUp, Modifier: gocui.ModNone, Handler: listContext.handlePrevLine}, + {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextItem-alt"), Modifier: gocui.ModNone, Handler: listContext.handleNextLine}, + {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextItem"), Modifier: gocui.ModNone, Handler: listContext.handleNextLine}, + {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevPage"), Modifier: gocui.ModNone, Handler: listContext.handlePrevPage, Description: gui.Tr.SLocalize("prevPage")}, + {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextPage"), Modifier: gocui.ModNone, Handler: listContext.handleNextPage, Description: gui.Tr.SLocalize("nextPage")}, + {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.gotoTop"), Modifier: gocui.ModNone, Handler: listContext.handleGotoTop, Description: gui.Tr.SLocalize("gotoTop")}, + {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gocui.MouseWheelDown, Modifier: gocui.ModNone, Handler: listContext.handleNextLine}, {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gocui.MouseLeft, Modifier: gocui.ModNone, Handler: listContext.handleClick}, }...) @@ -537,6 +537,7 @@ func (gui *Gui) getListContextKeyBindings() []*Binding { Key: gui.getKey("universal.startSearch"), Handler: openSearchHandler, Description: gui.Tr.SLocalize("startSearch"), + Tag: "navigation", }, { ViewName: listContext.ViewName, @@ -544,6 +545,7 @@ func (gui *Gui) getListContextKeyBindings() []*Binding { Key: gui.getKey("universal.gotoBottom"), Handler: gotoBottomHandler, Description: gui.Tr.SLocalize("gotoBottom"), + Tag: "navigation", }, }...) } diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index c90017896..f56d4c1c7 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -572,7 +572,7 @@ func addDutch(i18nObject *i18n.Bundle) error { ID: "CommitMessageTitle", Other: "Commit Bericht", }, &i18n.Message{ - ID: "Local-BranchesTitle", + ID: "LocalBranchesTitle", Other: "Branches Tab", }, &i18n.Message{ ID: "SearchTitle", @@ -581,7 +581,7 @@ func addDutch(i18nObject *i18n.Bundle) error { ID: "TagsTitle", Other: "Tags Tab", }, &i18n.Message{ - ID: "Branch-CommitsTitle", + ID: "BranchCommitsTitle", Other: "Commits Tab", }, &i18n.Message{ ID: "MenuTitle", @@ -593,10 +593,10 @@ func addDutch(i18nObject *i18n.Bundle) error { ID: "CredentialsTitle", Other: "Credentials", }, &i18n.Message{ - ID: "Remote-BranchesTitle", + ID: "RemoteBranchesTitle", Other: "Remote Branches (in Remotes tab)", }, &i18n.Message{ - ID: "Patch-BuildingTitle", + ID: "PatchBuildingTitle", Other: "Patch Bouwen", }, &i18n.Message{ ID: "InformationTitle", @@ -605,7 +605,7 @@ func addDutch(i18nObject *i18n.Bundle) error { ID: "SecondaryTitle", Other: "Secondary", }, &i18n.Message{ - ID: "Reflog-CommitsTitle", + ID: "ReflogCommitsTitle", Other: "Reflog Tab", }, &i18n.Message{ ID: "Title", diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 9c79ccb7d..acaf233ff 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -580,7 +580,7 @@ func addEnglish(i18nObject *i18n.Bundle) error { ID: "CommitMessageTitle", Other: "Commit Message", }, &i18n.Message{ - ID: "Local-BranchesTitle", + ID: "LocalBranchesTitle", Other: "Branches Tab", }, &i18n.Message{ ID: "SearchTitle", @@ -589,7 +589,7 @@ func addEnglish(i18nObject *i18n.Bundle) error { ID: "TagsTitle", Other: "Tags Tab", }, &i18n.Message{ - ID: "Branch-CommitsTitle", + ID: "BranchCommitsTitle", Other: "Commits Tab", }, &i18n.Message{ ID: "MenuTitle", @@ -601,10 +601,10 @@ func addEnglish(i18nObject *i18n.Bundle) error { ID: "CredentialsTitle", Other: "Credentials", }, &i18n.Message{ - ID: "Remote-BranchesTitle", + ID: "RemoteBranchesTitle", Other: "Remote Branches (in Remotes tab)", }, &i18n.Message{ - ID: "Patch-BuildingTitle", + ID: "PatchBuildingTitle", Other: "Patch Building", }, &i18n.Message{ ID: "InformationTitle", @@ -613,7 +613,7 @@ func addEnglish(i18nObject *i18n.Bundle) error { ID: "SecondaryTitle", Other: "Secondary", }, &i18n.Message{ - ID: "Reflog-CommitsTitle", + ID: "ReflogCommitsTitle", Other: "Reflog Tab", }, &i18n.Message{ ID: "Title", @@ -1272,6 +1272,15 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "runningCommand", Other: "running command", + }, &i18n.Message{ + ID: "SubCommitsTitle", + Other: "Sub-commits", + }, &i18n.Message{ + ID: "SubmodulesTitle", + Other: "Submodules", + }, &i18n.Message{ + ID: "NavigationTitle", + Other: "List Panel Navigation", }, ) } diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go index 0b468f2d0..53a816ff5 100644 --- a/scripts/generate_cheatsheet.go +++ b/scripts/generate_cheatsheet.go @@ -72,13 +72,31 @@ func getBindingSections(mApp *app.App) []*bindingSection { bindings := mApp.Gui.GetInitialKeybindings() type contextAndViewType struct { - context string - viewName string + subtitle string + title string } contextAndViewBindingMap := map[contextAndViewType][]*gui.Binding{} +outer: for _, binding := range bindings { + if binding.Tag == "navigation" { + key := contextAndViewType{subtitle: "", title: "navigation"} + existing := contextAndViewBindingMap[key] + if existing == nil { + contextAndViewBindingMap[key] = []*gui.Binding{binding} + } else { + for _, navBinding := range contextAndViewBindingMap[key] { + if navBinding.Description == binding.Description { + continue outer + } + } + contextAndViewBindingMap[key] = append(contextAndViewBindingMap[key], binding) + } + + continue outer + } + contexts := []string{} if len(binding.Contexts) == 0 { contexts = append(contexts, "") @@ -87,7 +105,7 @@ func getBindingSections(mApp *app.App) []*bindingSection { } for _, context := range contexts { - key := contextAndViewType{context: context, viewName: binding.ViewName} + key := contextAndViewType{subtitle: context, title: binding.ViewName} existing := contextAndViewBindingMap[key] if existing == nil { contextAndViewBindingMap[key] = []*gui.Binding{binding} @@ -111,33 +129,39 @@ func getBindingSections(mApp *app.App) []*bindingSection { sort.Slice(groupedBindings, func(i, j int) bool { first := groupedBindings[i].contextAndView second := groupedBindings[j].contextAndView - if first.viewName == "" { + if first.title == "" { return true } - if second.viewName == "" { + if second.title == "" { return false } - return first.viewName < second.viewName || (first.viewName == second.viewName && first.context < second.context) + if first.title == "navigation" { + return true + } + if second.title == "navigation" { + return false + } + return first.title < second.title || (first.title == second.title && first.subtitle < second.subtitle) }) for _, group := range groupedBindings { contextAndView := group.contextAndView contextBindings := group.bindings - mApp.Log.Info("viewname: " + contextAndView.viewName + ", context: " + contextAndView.context) - viewName := contextAndView.viewName + mApp.Log.Info("viewname: " + contextAndView.title + ", context: " + contextAndView.subtitle) + viewName := contextAndView.title if viewName == "" { viewName = "global" } translatedView := localisedTitle(mApp, viewName) var title string - if contextAndView.context == "" { + if contextAndView.subtitle == "" { addendum := " " + mApp.Tr.SLocalize("Panel") - if viewName == "global" { + if viewName == "global" || viewName == "navigation" { addendum = "" } title = fmt.Sprintf("%s%s", translatedView, addendum) } else { - translatedContextName := localisedTitle(mApp, contextAndView.context) + translatedContextName := localisedTitle(mApp, contextAndView.subtitle) title = fmt.Sprintf("%s %s (%s)", translatedView, mApp.Tr.SLocalize("Panel"), translatedContextName) }