diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index 9b613792b..acac130a4 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -5,7 +5,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct ## Global Keybindings
-  ctrl+r: switch to a recent repo ()
+  ctrl+r: switch to a recent repo
   pgup: scroll up main panel (fn+up)
   pgdown: scroll down main panel (fn+down)
   m: view merge/rebase options
@@ -35,6 +35,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
   <: scroll to top
   >: scroll to bottom
   /: start search
+  H: scroll left
+  L: scroll right
   ]: next tab
   [: previous tab
 
@@ -45,12 +47,12 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct ctrl+o: copy branch name to clipboard i: show git-flow options space: checkout + n: new branch o: create pull request O: create pull request options ctrl+y: copy pull request URL to clipboard c: checkout by name F: force checkout - n: new branch d: delete branch r: rebase checked-out branch onto this branch M: merge into currently checked out branch @@ -218,8 +220,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct ## Main Panel (Merging)
-  H: scroll left
-  L: scroll right
   esc: return to files panel
   M: open external merge tool (git mergetool)
   space: pick hunk
@@ -234,8 +234,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
 ## Main Panel (Normal)
 
 
-  Ő: scroll down (fn+up)
-  ő: scroll up (fn+down)
+  mouse wheel down: scroll down (fn+up)
+  mouse wheel up: scroll up (fn+down)
 
## Main Panel (Patch Building) @@ -252,8 +252,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct v: toggle drag select V: toggle drag select a: toggle select hunk - H: scroll left - L: scroll right
## Main Panel (Staging) @@ -274,8 +272,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct v: toggle drag select V: toggle drag select a: toggle select hunk - H: scroll left - L: scroll right c: commit changes w: commit changes without pre-commit hook C: commit changes using git editor @@ -297,7 +293,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct enter: view selected item's files -## Status Panel +## Status Panel (Status)
   e: edit config file
diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md
index 734f7135d..5b076f637 100644
--- a/docs/keybindings/Keybindings_nl.md
+++ b/docs/keybindings/Keybindings_nl.md
@@ -5,7 +5,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
 ## Globale Sneltoetsen
 
 
-  ctrl+r: wissel naar een recente repo ()
+  ctrl+r: wissel naar een recente repo
   pgup: scroll naar beneden vanaf hoofdpaneel (fn+up)
   pgdown: scroll naar beneden vanaf hoofdpaneel (fn+down)
   m: bekijk merge/rebase opties
@@ -36,6 +36,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
   <: scroll naar boven
   >: scroll naar beneden
   /: start met zoeken
+  H: scroll left
+  L: scroll right
   ]: volgende tabblad
   [: vorige tabblad
 
@@ -46,12 +48,12 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct ctrl+o: kopieer branch name naar klembord i: laat git-flow opties zien space: uitchecken + n: nieuwe branch o: maak een pull-request O: bekijk opties voor pull-aanvraag ctrl+y: kopieer de URL van het pull-verzoek naar het klembord c: uitchecken bij naam F: forceer checkout - n: nieuwe branch d: verwijder branch r: rebase branch M: merge in met huidige checked out branch @@ -216,8 +218,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct ## Hoofd Paneel (Mergen)
-  H: scroll left
-  L: scroll right
   esc: ga terug naar het bestanden paneel
   M: open external merge tool (git mergetool)
   space: kies hunk
@@ -232,8 +232,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
 ## Hoofd Paneel (Normaal)
 
 
-  Ő: scroll omlaag (fn+up)
-  ő: scroll omhoog (fn+down)
+  mouse wheel down: scroll omlaag (fn+up)
+  mouse wheel up: scroll omhoog (fn+down)
 
## Hoofd Paneel (Patch Bouwen) @@ -250,8 +250,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct v: toggle drag selecteer V: toggle drag selecteer a: toggle selecteer hunk - H: scroll left - L: scroll right
## Hoofd Paneel (Staging) @@ -295,7 +293,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct enter: bekijk gecommite bestanden
-## Status Paneel +## Status Paneel (Status)
   e: verander config bestand
diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md
index 8dd8ff8aa..fd26ea20d 100644
--- a/docs/keybindings/Keybindings_pl.md
+++ b/docs/keybindings/Keybindings_pl.md
@@ -5,7 +5,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
 ## Globalne
 
 
-  ctrl+r: switch to a recent repo ()
+  ctrl+r: switch to a recent repo
   pgup: scroll up main panel (fn+up)
   pgdown: scroll down main panel (fn+down)
   m: widok scalenia/opcje zmiany bazy
@@ -35,6 +35,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
   <: scroll to top
   >: scroll to bottom
   /: start search
+  H: scroll left
+  L: scroll right
   ]: next tab
   [: previous tab
 
@@ -45,12 +47,12 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct ctrl+o: copy branch name to clipboard i: show git-flow options space: przełącz + n: nowa gałąź o: utwórz żądanie pobrania O: utwórz opcje żądania ściągnięcia ctrl+y: skopiuj adres URL żądania pobrania do schowka c: przełącz używając nazwy F: wymuś przełączenie - n: nowa gałąź d: usuń gałąź r: zmiana bazy gałęzi M: scal do obecnej gałęzi @@ -218,8 +220,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct ## Główne Panel (Scalanie)
-  H: scroll left
-  L: scroll right
   esc: wróć do panelu plików
   M: open external merge tool (git mergetool)
   space: wybierz kawałek
@@ -234,8 +234,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
 ## Główne Panel (Zwykłe)
 
 
-  Ő: przewiń w dół (fn+up)
-  ő: przewiń w górę (fn+down)
+  mouse wheel down: przewiń w dół (fn+up)
+  mouse wheel up: przewiń w górę (fn+down)
 
## Główne Panel (Patch Building) @@ -252,8 +252,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct v: toggle drag select V: toggle drag select a: toggle select hunk - H: scroll left - L: scroll right
## Główne Panel (Poczekalnia) @@ -274,8 +272,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct v: toggle drag select V: toggle drag select a: toggle select hunk - H: scroll left - L: scroll right c: Zatwierdź zmiany w: zatwierdź zmiany bez skryptu pre-commit C: Zatwierdź zmiany używając edytora @@ -297,7 +293,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct enter: przeglądaj pliki commita
-## Status Panel +## Status Panel (Status)
   e: edytuj konfigurację
diff --git a/docs/keybindings/Keybindings_zh.md b/docs/keybindings/Keybindings_zh.md
index 34a60a0e5..c075a7879 100644
--- a/docs/keybindings/Keybindings_zh.md
+++ b/docs/keybindings/Keybindings_zh.md
@@ -5,7 +5,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
 ## 全局键绑定
 
 
-  ctrl+r: 切换到最近的仓库 ()
+  ctrl+r: 切换到最近的仓库
   pgup: 向上滚动主面板 (fn+up)
   pgdown: 向下滚动主面板 (fn+down)
   m: 查看 合并/变基 选项
@@ -35,6 +35,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
   <: 滚动到顶部
   >: 滚动到底部
   /: 开始搜索
+  H: scroll left
+  L: scroll right
   ]: 下一个标签
   [: 上一个标签
 
@@ -45,12 +47,12 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct ctrl+o: 将分支名称复制到剪贴板 i: 显示 git-flow 选项 space: 检出 + n: 新分支 o: 创建抓取请求 O: 创建抓取请求选项 ctrl+y: 将抓取请求 URL 复制到剪贴板 c: 按名称检出 F: 强制检出 - n: 新分支 d: 删除分支 r: 将已检出的分支变基到该分支 M: 合并到当前检出的分支 @@ -218,8 +220,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct ## 主要 面板 (合并中)
-  H: scroll left
-  L: scroll right
   esc: 返回文件面板
   M: 打开合并工具
   space: 选中区块
@@ -234,8 +234,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
 ## 主要 面板 (正常)
 
 
-  Ő: 向下滚动 (fn+up)
-  ő: 向上滚动 (fn+down)
+  mouse wheel down: 向下滚动 (fn+up)
+  mouse wheel up: 向上滚动 (fn+down)
 
## 主要 面板 (构建补丁中) @@ -252,8 +252,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct v: 切换拖动选择 V: 切换拖动选择 a: 切换选择区块 - H: scroll left - L: scroll right
## 主要 面板 (正在暂存) @@ -274,8 +272,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct v: 切换拖动选择 V: 切换拖动选择 a: 切换选择区块 - H: scroll left - L: scroll right c: 提交更改 w: 提交更改而无需预先提交钩子 C: 提交更改(使用编辑器编辑提交信息) @@ -297,7 +293,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct enter: 查看提交的文件
-## 状态 面板 +## 状态 面板 (状态)
   e: 编辑配置文件
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go
index d6a586a10..2bf2b9815 100644
--- a/pkg/gui/keybindings.go
+++ b/pkg/gui/keybindings.go
@@ -15,64 +15,66 @@ import (
 )
 
 var keyMapReversed = map[gocui.Key]string{
-	gocui.KeyF1:         "f1",
-	gocui.KeyF2:         "f2",
-	gocui.KeyF3:         "f3",
-	gocui.KeyF4:         "f4",
-	gocui.KeyF5:         "f5",
-	gocui.KeyF6:         "f6",
-	gocui.KeyF7:         "f7",
-	gocui.KeyF8:         "f8",
-	gocui.KeyF9:         "f9",
-	gocui.KeyF10:        "f10",
-	gocui.KeyF11:        "f11",
-	gocui.KeyF12:        "f12",
-	gocui.KeyInsert:     "insert",
-	gocui.KeyDelete:     "delete",
-	gocui.KeyHome:       "home",
-	gocui.KeyEnd:        "end",
-	gocui.KeyPgup:       "pgup",
-	gocui.KeyPgdn:       "pgdown",
-	gocui.KeyArrowUp:    "▲",
-	gocui.KeyArrowDown:  "▼",
-	gocui.KeyArrowLeft:  "◄",
-	gocui.KeyArrowRight: "►",
-	gocui.KeyTab:        "tab", // ctrl+i
-	gocui.KeyBacktab:    "shift+tab",
-	gocui.KeyEnter:      "enter", // ctrl+m
-	gocui.KeyAltEnter:   "alt+enter",
-	gocui.KeyEsc:        "esc",        // ctrl+[, ctrl+3
-	gocui.KeyBackspace:  "backspace",  // ctrl+h
-	gocui.KeyCtrlSpace:  "ctrl+space", // ctrl+~, ctrl+2
-	gocui.KeyCtrlSlash:  "ctrl+/",     // ctrl+_
-	gocui.KeySpace:      "space",
-	gocui.KeyCtrlA:      "ctrl+a",
-	gocui.KeyCtrlB:      "ctrl+b",
-	gocui.KeyCtrlC:      "ctrl+c",
-	gocui.KeyCtrlD:      "ctrl+d",
-	gocui.KeyCtrlE:      "ctrl+e",
-	gocui.KeyCtrlF:      "ctrl+f",
-	gocui.KeyCtrlG:      "ctrl+g",
-	gocui.KeyCtrlJ:      "ctrl+j",
-	gocui.KeyCtrlK:      "ctrl+k",
-	gocui.KeyCtrlL:      "ctrl+l",
-	gocui.KeyCtrlN:      "ctrl+n",
-	gocui.KeyCtrlO:      "ctrl+o",
-	gocui.KeyCtrlP:      "ctrl+p",
-	gocui.KeyCtrlQ:      "ctrl+q",
-	gocui.KeyCtrlR:      "ctrl+r",
-	gocui.KeyCtrlS:      "ctrl+s",
-	gocui.KeyCtrlT:      "ctrl+t",
-	gocui.KeyCtrlU:      "ctrl+u",
-	gocui.KeyCtrlV:      "ctrl+v",
-	gocui.KeyCtrlW:      "ctrl+w",
-	gocui.KeyCtrlX:      "ctrl+x",
-	gocui.KeyCtrlY:      "ctrl+y",
-	gocui.KeyCtrlZ:      "ctrl+z",
-	gocui.KeyCtrl4:      "ctrl+4", // ctrl+\
-	gocui.KeyCtrl5:      "ctrl+5", // ctrl+]
-	gocui.KeyCtrl6:      "ctrl+6",
-	gocui.KeyCtrl8:      "ctrl+8",
+	gocui.KeyF1:          "f1",
+	gocui.KeyF2:          "f2",
+	gocui.KeyF3:          "f3",
+	gocui.KeyF4:          "f4",
+	gocui.KeyF5:          "f5",
+	gocui.KeyF6:          "f6",
+	gocui.KeyF7:          "f7",
+	gocui.KeyF8:          "f8",
+	gocui.KeyF9:          "f9",
+	gocui.KeyF10:         "f10",
+	gocui.KeyF11:         "f11",
+	gocui.KeyF12:         "f12",
+	gocui.KeyInsert:      "insert",
+	gocui.KeyDelete:      "delete",
+	gocui.KeyHome:        "home",
+	gocui.KeyEnd:         "end",
+	gocui.KeyPgup:        "pgup",
+	gocui.KeyPgdn:        "pgdown",
+	gocui.KeyArrowUp:     "▲",
+	gocui.KeyArrowDown:   "▼",
+	gocui.KeyArrowLeft:   "◄",
+	gocui.KeyArrowRight:  "►",
+	gocui.KeyTab:         "tab", // ctrl+i
+	gocui.KeyBacktab:     "shift+tab",
+	gocui.KeyEnter:       "enter", // ctrl+m
+	gocui.KeyAltEnter:    "alt+enter",
+	gocui.KeyEsc:         "esc",        // ctrl+[, ctrl+3
+	gocui.KeyBackspace:   "backspace",  // ctrl+h
+	gocui.KeyCtrlSpace:   "ctrl+space", // ctrl+~, ctrl+2
+	gocui.KeyCtrlSlash:   "ctrl+/",     // ctrl+_
+	gocui.KeySpace:       "space",
+	gocui.KeyCtrlA:       "ctrl+a",
+	gocui.KeyCtrlB:       "ctrl+b",
+	gocui.KeyCtrlC:       "ctrl+c",
+	gocui.KeyCtrlD:       "ctrl+d",
+	gocui.KeyCtrlE:       "ctrl+e",
+	gocui.KeyCtrlF:       "ctrl+f",
+	gocui.KeyCtrlG:       "ctrl+g",
+	gocui.KeyCtrlJ:       "ctrl+j",
+	gocui.KeyCtrlK:       "ctrl+k",
+	gocui.KeyCtrlL:       "ctrl+l",
+	gocui.KeyCtrlN:       "ctrl+n",
+	gocui.KeyCtrlO:       "ctrl+o",
+	gocui.KeyCtrlP:       "ctrl+p",
+	gocui.KeyCtrlQ:       "ctrl+q",
+	gocui.KeyCtrlR:       "ctrl+r",
+	gocui.KeyCtrlS:       "ctrl+s",
+	gocui.KeyCtrlT:       "ctrl+t",
+	gocui.KeyCtrlU:       "ctrl+u",
+	gocui.KeyCtrlV:       "ctrl+v",
+	gocui.KeyCtrlW:       "ctrl+w",
+	gocui.KeyCtrlX:       "ctrl+x",
+	gocui.KeyCtrlY:       "ctrl+y",
+	gocui.KeyCtrlZ:       "ctrl+z",
+	gocui.KeyCtrl4:       "ctrl+4", // ctrl+\
+	gocui.KeyCtrl5:       "ctrl+5", // ctrl+]
+	gocui.KeyCtrl6:       "ctrl+6",
+	gocui.KeyCtrl8:       "ctrl+8",
+	gocui.MouseWheelUp:   "mouse wheel up",
+	gocui.MouseWheelDown: "mouse wheel down",
 }
 
 var keymap = map[string]interface{}{
@@ -249,7 +251,6 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
 			ViewName:    "",
 			Key:         opts.GetKey(opts.Config.Universal.OpenRecentRepos),
 			Handler:     self.handleCreateRecentReposMenu,
-			Alternative: "",
 			Description: self.c.Tr.SwitchRepo,
 		},
 		{
@@ -325,6 +326,7 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
 		},
 		{
 			ViewName:    "status",
+			Contexts:    []string{string(context.STATUS_CONTEXT_KEY)},
 			Key:         opts.GetKey(opts.Config.Universal.Edit),
 			Handler:     self.handleEditConfig,
 			Description: self.c.Tr.EditConfig,
@@ -343,24 +345,28 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
 		},
 		{
 			ViewName:    "status",
+			Contexts:    []string{string(context.STATUS_CONTEXT_KEY)},
 			Key:         opts.GetKey(opts.Config.Universal.OpenFile),
 			Handler:     self.handleOpenConfig,
 			Description: self.c.Tr.OpenConfig,
 		},
 		{
 			ViewName:    "status",
+			Contexts:    []string{string(context.STATUS_CONTEXT_KEY)},
 			Key:         opts.GetKey(opts.Config.Status.CheckForUpdate),
 			Handler:     self.handleCheckForUpdate,
 			Description: self.c.Tr.LcCheckForUpdate,
 		},
 		{
 			ViewName:    "status",
+			Contexts:    []string{string(context.STATUS_CONTEXT_KEY)},
 			Key:         opts.GetKey(opts.Config.Status.RecentRepos),
 			Handler:     self.handleCreateRecentReposMenu,
 			Description: self.c.Tr.SwitchRepo,
 		},
 		{
 			ViewName:    "status",
+			Contexts:    []string{string(context.STATUS_CONTEXT_KEY)},
 			Key:         opts.GetKey(opts.Config.Status.AllBranchesLogGraph),
 			Handler:     self.handleShowAllBranchLogs,
 			Description: self.c.Tr.LcAllBranchesLogGraph,
@@ -729,6 +735,7 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
 			Key:         opts.GetKey(opts.Config.Universal.ScrollLeft),
 			Handler:     self.scrollLeftMain,
 			Description: self.c.Tr.LcScrollLeft,
+			Tag:         "navigation",
 		},
 		{
 			ViewName:    "main",
@@ -736,6 +743,7 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
 			Key:         opts.GetKey(opts.Config.Universal.ScrollRight),
 			Handler:     self.scrollRightMain,
 			Description: self.c.Tr.LcScrollRight,
+			Tag:         "navigation",
 		},
 		{
 			ViewName:    "main",
diff --git a/pkg/gui/options_menu_panel.go b/pkg/gui/options_menu_panel.go
index 17ced988e..85ed34b5d 100644
--- a/pkg/gui/options_menu_panel.go
+++ b/pkg/gui/options_menu_panel.go
@@ -12,7 +12,7 @@ import (
 
 func (gui *Gui) getBindings(context types.Context) []*types.Binding {
 	var (
-		bindingsGlobal, bindingsPanel []*types.Binding
+		bindingsGlobal, bindingsPanel, bindingsNavigation []*types.Binding
 	)
 
 	bindings, _ := gui.GetInitialKeybindings()
@@ -24,18 +24,40 @@ func (gui *Gui) getBindings(context types.Context) []*types.Binding {
 
 	for _, binding := range bindings {
 		if GetKeyDisplay(binding.Key) != "" && binding.Description != "" {
-			if len(binding.Contexts) == 0 {
+			if len(binding.Contexts) == 0 && binding.ViewName == "" {
 				bindingsGlobal = append(bindingsGlobal, binding)
+			} else if binding.Tag == "navigation" {
+				bindingsNavigation = append(bindingsNavigation, binding)
 			} else if utils.IncludesString(binding.Contexts, string(context.GetKey())) {
 				bindingsPanel = append(bindingsPanel, binding)
 			}
 		}
 	}
 
-	// append dummy element to have a separator between
-	// panel and global keybindings
-	bindingsPanel = append(bindingsPanel, &types.Binding{})
-	return append(bindingsPanel, bindingsGlobal...)
+	resultBindings := []*types.Binding{}
+	resultBindings = append(resultBindings, uniqueBindings(bindingsPanel)...)
+	// adding a separator between the panel-specific bindings and the other bindings
+	resultBindings = append(resultBindings, &types.Binding{})
+	resultBindings = append(resultBindings, uniqueBindings(bindingsGlobal)...)
+	resultBindings = append(resultBindings, uniqueBindings(bindingsNavigation)...)
+
+	return resultBindings
+}
+
+// We shouldn't really need to do this. We should define alternative keys for the same
+// handler in the keybinding struct.
+func uniqueBindings(bindings []*types.Binding) []*types.Binding {
+	keys := make(map[string]bool)
+	result := make([]*types.Binding, 0)
+
+	for _, binding := range bindings {
+		if _, ok := keys[binding.Description]; !ok {
+			keys[binding.Description] = true
+			result = append(result, binding)
+		}
+	}
+
+	return result
 }
 
 func (gui *Gui) displayDescription(binding *types.Binding) string {