1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-02 22:25:47 +02:00

clean up keybindings menu

This commit is contained in:
Jesse Duffield 2022-02-27 16:46:27 +11:00
parent 36c149836a
commit fb3752c11f
6 changed files with 123 additions and 107 deletions

View File

@ -5,7 +5,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Global Keybindings
<pre>
<kbd>ctrl+r</kbd>: switch to a recent repo (<c-r>)
<kbd>ctrl+r</kbd>: switch to a recent repo
<kbd>pgup</kbd>: scroll up main panel (fn+up)
<kbd>pgdown</kbd>: scroll down main panel (fn+down)
<kbd>m</kbd>: view merge/rebase options
@ -35,6 +35,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd><</kbd>: scroll to top
<kbd>></kbd>: scroll to bottom
<kbd>/</kbd>: start search
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>]</kbd>: next tab
<kbd>[</kbd>: previous tab
</pre>
@ -45,12 +47,12 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>ctrl+o</kbd>: copy branch name to clipboard
<kbd>i</kbd>: show git-flow options
<kbd>space</kbd>: checkout
<kbd>n</kbd>: new branch
<kbd>o</kbd>: create pull request
<kbd>O</kbd>: create pull request options
<kbd>ctrl+y</kbd>: copy pull request URL to clipboard
<kbd>c</kbd>: checkout by name
<kbd>F</kbd>: force checkout
<kbd>n</kbd>: new branch
<kbd>d</kbd>: delete branch
<kbd>r</kbd>: rebase checked-out branch onto this branch
<kbd>M</kbd>: 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)
<pre>
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>esc</kbd>: return to files panel
<kbd>M</kbd>: open external merge tool (git mergetool)
<kbd>space</kbd>: pick hunk
@ -234,8 +234,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Main Panel (Normal)
<pre>
<kbd>Ő</kbd>: scroll down (fn+up)
<kbd>ő</kbd>: scroll up (fn+down)
<kbd>mouse wheel down</kbd>: scroll down (fn+up)
<kbd>mouse wheel up</kbd>: scroll up (fn+down)
</pre>
## Main Panel (Patch Building)
@ -252,8 +252,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>v</kbd>: toggle drag select
<kbd>V</kbd>: toggle drag select
<kbd>a</kbd>: toggle select hunk
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
</pre>
## Main Panel (Staging)
@ -274,8 +272,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>v</kbd>: toggle drag select
<kbd>V</kbd>: toggle drag select
<kbd>a</kbd>: toggle select hunk
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>c</kbd>: commit changes
<kbd>w</kbd>: commit changes without pre-commit hook
<kbd>C</kbd>: commit changes using git editor
@ -297,7 +293,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>enter</kbd>: view selected item's files
</pre>
## Status Panel
## Status Panel (Status)
<pre>
<kbd>e</kbd>: edit config file

View File

@ -5,7 +5,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Globale Sneltoetsen
<pre>
<kbd>ctrl+r</kbd>: wissel naar een recente repo (<c-r>)
<kbd>ctrl+r</kbd>: wissel naar een recente repo
<kbd>pgup</kbd>: scroll naar beneden vanaf hoofdpaneel (fn+up)
<kbd>pgdown</kbd>: scroll naar beneden vanaf hoofdpaneel (fn+down)
<kbd>m</kbd>: bekijk merge/rebase opties
@ -36,6 +36,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd><</kbd>: scroll naar boven
<kbd>></kbd>: scroll naar beneden
<kbd>/</kbd>: start met zoeken
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>]</kbd>: volgende tabblad
<kbd>[</kbd>: vorige tabblad
</pre>
@ -46,12 +48,12 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>ctrl+o</kbd>: kopieer branch name naar klembord
<kbd>i</kbd>: laat git-flow opties zien
<kbd>space</kbd>: uitchecken
<kbd>n</kbd>: nieuwe branch
<kbd>o</kbd>: maak een pull-request
<kbd>O</kbd>: bekijk opties voor pull-aanvraag
<kbd>ctrl+y</kbd>: kopieer de URL van het pull-verzoek naar het klembord
<kbd>c</kbd>: uitchecken bij naam
<kbd>F</kbd>: forceer checkout
<kbd>n</kbd>: nieuwe branch
<kbd>d</kbd>: verwijder branch
<kbd>r</kbd>: rebase branch
<kbd>M</kbd>: 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)
<pre>
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>esc</kbd>: ga terug naar het bestanden paneel
<kbd>M</kbd>: open external merge tool (git mergetool)
<kbd>space</kbd>: kies hunk
@ -232,8 +232,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Hoofd Paneel (Normaal)
<pre>
<kbd>Ő</kbd>: scroll omlaag (fn+up)
<kbd>ő</kbd>: scroll omhoog (fn+down)
<kbd>mouse wheel down</kbd>: scroll omlaag (fn+up)
<kbd>mouse wheel up</kbd>: scroll omhoog (fn+down)
</pre>
## Hoofd Paneel (Patch Bouwen)
@ -250,8 +250,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>v</kbd>: toggle drag selecteer
<kbd>V</kbd>: toggle drag selecteer
<kbd>a</kbd>: toggle selecteer hunk
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
</pre>
## Hoofd Paneel (Staging)
@ -295,7 +293,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>enter</kbd>: bekijk gecommite bestanden
</pre>
## Status Paneel
## Status Paneel (Status)
<pre>
<kbd>e</kbd>: verander config bestand

View File

@ -5,7 +5,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Globalne
<pre>
<kbd>ctrl+r</kbd>: switch to a recent repo (<c-r>)
<kbd>ctrl+r</kbd>: switch to a recent repo
<kbd>pgup</kbd>: scroll up main panel (fn+up)
<kbd>pgdown</kbd>: scroll down main panel (fn+down)
<kbd>m</kbd>: widok scalenia/opcje zmiany bazy
@ -35,6 +35,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd><</kbd>: scroll to top
<kbd>></kbd>: scroll to bottom
<kbd>/</kbd>: start search
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>]</kbd>: next tab
<kbd>[</kbd>: previous tab
</pre>
@ -45,12 +47,12 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>ctrl+o</kbd>: copy branch name to clipboard
<kbd>i</kbd>: show git-flow options
<kbd>space</kbd>: przełącz
<kbd>n</kbd>: nowa gałąź
<kbd>o</kbd>: utwórz żądanie pobrania
<kbd>O</kbd>: utwórz opcje żądania ściągnięcia
<kbd>ctrl+y</kbd>: skopiuj adres URL żądania pobrania do schowka
<kbd>c</kbd>: przełącz używając nazwy
<kbd>F</kbd>: wymuś przełączenie
<kbd>n</kbd>: nowa gałąź
<kbd>d</kbd>: usuń gałąź
<kbd>r</kbd>: zmiana bazy gałęzi
<kbd>M</kbd>: 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)
<pre>
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>esc</kbd>: wróć do panelu plików
<kbd>M</kbd>: open external merge tool (git mergetool)
<kbd>space</kbd>: 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)
<pre>
<kbd>Ő</kbd>: przewiń w dół (fn+up)
<kbd>ő</kbd>: przewiń w górę (fn+down)
<kbd>mouse wheel down</kbd>: przewiń w dół (fn+up)
<kbd>mouse wheel up</kbd>: przewiń w górę (fn+down)
</pre>
## Główne Panel (Patch Building)
@ -252,8 +252,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>v</kbd>: toggle drag select
<kbd>V</kbd>: toggle drag select
<kbd>a</kbd>: toggle select hunk
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
</pre>
## Główne Panel (Poczekalnia)
@ -274,8 +272,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>v</kbd>: toggle drag select
<kbd>V</kbd>: toggle drag select
<kbd>a</kbd>: toggle select hunk
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>c</kbd>: Zatwierdź zmiany
<kbd>w</kbd>: zatwierdź zmiany bez skryptu pre-commit
<kbd>C</kbd>: 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
<kbd>enter</kbd>: przeglądaj pliki commita
</pre>
## Status Panel
## Status Panel (Status)
<pre>
<kbd>e</kbd>: edytuj konfigurację

View File

@ -5,7 +5,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## 全局键绑定
<pre>
<kbd>ctrl+r</kbd>: 切换到最近的仓库 (<c-r>)
<kbd>ctrl+r</kbd>: 切换到最近的仓库
<kbd>pgup</kbd>: 向上滚动主面板 (fn+up)
<kbd>pgdown</kbd>: 向下滚动主面板 (fn+down)
<kbd>m</kbd>: 查看 合并/变基 选项
@ -35,6 +35,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd><</kbd>: 滚动到顶部
<kbd>></kbd>: 滚动到底部
<kbd>/</kbd>: 开始搜索
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>]</kbd>: 下一个标签
<kbd>[</kbd>: 上一个标签
</pre>
@ -45,12 +47,12 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>ctrl+o</kbd>: 将分支名称复制到剪贴板
<kbd>i</kbd>: 显示 git-flow 选项
<kbd>space</kbd>: 检出
<kbd>n</kbd>: 新分支
<kbd>o</kbd>: 创建抓取请求
<kbd>O</kbd>: 创建抓取请求选项
<kbd>ctrl+y</kbd>: 将抓取请求 URL 复制到剪贴板
<kbd>c</kbd>: 按名称检出
<kbd>F</kbd>: 强制检出
<kbd>n</kbd>: 新分支
<kbd>d</kbd>: 删除分支
<kbd>r</kbd>: 将已检出的分支变基到该分支
<kbd>M</kbd>: 合并到当前检出的分支
@ -218,8 +220,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## 主要 面板 (合并中)
<pre>
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>esc</kbd>: 返回文件面板
<kbd>M</kbd>: 打开合并工具
<kbd>space</kbd>: 选中区块
@ -234,8 +234,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## 主要 面板 (正常)
<pre>
<kbd>Ő</kbd>: 向下滚动 (fn+up)
<kbd>ő</kbd>: 向上滚动 (fn+down)
<kbd>mouse wheel down</kbd>: 向下滚动 (fn+up)
<kbd>mouse wheel up</kbd>: 向上滚动 (fn+down)
</pre>
## 主要 面板 (构建补丁中)
@ -252,8 +252,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>v</kbd>: 切换拖动选择
<kbd>V</kbd>: 切换拖动选择
<kbd>a</kbd>: 切换选择区块
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
</pre>
## 主要 面板 (正在暂存)
@ -274,8 +272,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>v</kbd>: 切换拖动选择
<kbd>V</kbd>: 切换拖动选择
<kbd>a</kbd>: 切换选择区块
<kbd>H</kbd>: scroll left
<kbd>L</kbd>: scroll right
<kbd>c</kbd>: 提交更改
<kbd>w</kbd>: 提交更改而无需预先提交钩子
<kbd>C</kbd>: 提交更改(使用编辑器编辑提交信息)
@ -297,7 +293,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>enter</kbd>: 查看提交的文件
</pre>
## 状态 面板
## 状态 面板 (状态)
<pre>
<kbd>e</kbd>: 编辑配置文件

View File

@ -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: "<c-r>",
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",

View File

@ -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 {