1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-07 13:42:01 +02:00

fix cheatsheet crash

This commit is contained in:
Jesse Duffield 2022-02-13 10:39:14 +11:00
parent 722410aded
commit 3188526ecb
7 changed files with 66 additions and 42 deletions

View File

@ -20,6 +20,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>@</kbd>: open command log menu
<kbd>}</kbd>: Increase the size of the context shown around changes in the diff view
<kbd>{</kbd>: Decrease the size of the context shown around changes in the diff view
<kbd>:</kbd>: execute custom command
<kbd>z</kbd>: undo (via reflog) (experimental)
<kbd>ctrl+z</kbd>: redo (via reflog) (experimental)
<kbd>P</kbd>: push
@ -41,6 +42,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Branches Panel (Branches Tab)
<pre>
<kbd>i</kbd>: show git-flow options
<kbd>ctrl+o</kbd>: copy branch name to clipboard
<kbd>space</kbd>: checkout
<kbd>o</kbd>: create pull request
<kbd>O</kbd>: create pull request options
@ -51,11 +54,9 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>d</kbd>: delete branch
<kbd>r</kbd>: rebase checked-out branch onto this branch
<kbd>M</kbd>: merge into currently checked out branch
<kbd>i</kbd>: show git-flow options
<kbd>f</kbd>: fast-forward this branch from its upstream
<kbd>g</kbd>: view reset options
<kbd>R</kbd>: rename branch
<kbd>ctrl+o</kbd>: copy branch name to clipboard
<kbd>enter</kbd>: view commits
</pre>
@ -64,13 +65,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<pre>
<kbd>esc</kbd>: Return to remotes list
<kbd>g</kbd>: view reset options
<kbd>enter</kbd>: view commits
<kbd>space</kbd>: checkout
<kbd>n</kbd>: new branch
<kbd>M</kbd>: merge into currently checked out branch
<kbd>d</kbd>: delete branch
<kbd>r</kbd>: rebase checked-out branch onto this branch
<kbd>u</kbd>: set as upstream of checked-out branch
<kbd>enter</kbd>: view commits
</pre>
## Branches Panel (Remotes Tab)
@ -122,12 +123,9 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Commits Panel (Commits)
<pre>
<kbd>c</kbd>: copy commit (cherry-pick)
<kbd>ctrl+o</kbd>: copy commit SHA to clipboard
<kbd>C</kbd>: copy commit range (cherry-pick)
<kbd>v</kbd>: paste commits (cherry-pick)
<kbd>n</kbd>: create new branch off of commit
<kbd>ctrl+r</kbd>: reset cherry-picked (copied) commits selection
<kbd>b</kbd>: view bisect options
<kbd>s</kbd>: squash down
<kbd>f</kbd>: fixup commit
<kbd>r</kbd>: reword commit
@ -141,6 +139,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>ctrl+k</kbd>: move commit up one
<kbd>A</kbd>: amend commit with staged changes
<kbd>t</kbd>: revert commit
<kbd>n</kbd>: create new branch off of commit
<kbd>c</kbd>: copy commit (cherry-pick)
<kbd>C</kbd>: copy commit range (cherry-pick)
<kbd>v</kbd>: paste commits (cherry-pick)
<kbd>ctrl+l</kbd>: open log menu
<kbd>g</kbd>: reset to this commit
<kbd>enter</kbd>: view commit's files
@ -148,7 +150,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>T</kbd>: tag commit
<kbd>ctrl+y</kbd>: copy commit message to clipboard
<kbd>o</kbd>: open commit in browser
<kbd>b</kbd>: view bisect options
</pre>
## Commits Panel (Reflog Tab)
@ -173,7 +174,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<pre>
<kbd>D</kbd>: view reset options
<kbd>f</kbd>: fetch
<kbd>ctrl+o</kbd>: copy the file name to the clipboard
<kbd>ctrl+w</kbd>: Toggle whether or not whitespace changes are shown in the diff view
<kbd>space</kbd>: toggle staged
@ -191,10 +191,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>S</kbd>: view stash options
<kbd>a</kbd>: stage/unstage all
<kbd>enter</kbd>: stage individual hunks/lines for file, or collapse/expand for directory
<kbd>:</kbd>: execute custom command
<kbd>g</kbd>: view upstream reset options
<kbd>`</kbd>: toggle file tree view
<kbd>M</kbd>: open external merge tool (git mergetool)
<kbd>f</kbd>: fetch
</pre>
## Files Panel (Submodules)

View File

@ -21,6 +21,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>@</kbd>: open command log menu
<kbd>}</kbd>: Increase the size of the context shown around changes in the diff view
<kbd>{</kbd>: Decrease the size of the context shown around changes in the diff view
<kbd>:</kbd>: voor aangepaste commando uit
<kbd>z</kbd>: ongedaan maken (via reflog) (experimenteel)
<kbd>ctrl+z</kbd>: redo (via reflog) (experimenteel)
<kbd>P</kbd>: push
@ -42,6 +43,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Branches Paneel (Branches Tabblad)
<pre>
<kbd>i</kbd>: laat git-flow opties zien
<kbd>ctrl+o</kbd>: kopieer branch name naar klembord
<kbd>space</kbd>: uitchecken
<kbd>o</kbd>: maak een pull-request
<kbd>O</kbd>: bekijk opties voor pull-aanvraag
@ -52,11 +55,9 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>d</kbd>: verwijder branch
<kbd>r</kbd>: rebase branch
<kbd>M</kbd>: merge in met huidige checked out branch
<kbd>i</kbd>: laat git-flow opties zien
<kbd>f</kbd>: fast-forward deze branch vanaf zijn upstream
<kbd>g</kbd>: bekijk reset opties
<kbd>R</kbd>: hernoem branch
<kbd>ctrl+o</kbd>: kopieer branch name naar klembord
<kbd>enter</kbd>: bekijk commits
</pre>
@ -65,13 +66,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<pre>
<kbd>esc</kbd>: ga terug naar remotes lijst
<kbd>g</kbd>: bekijk reset opties
<kbd>enter</kbd>: bekijk commits
<kbd>space</kbd>: uitchecken
<kbd>n</kbd>: nieuwe branch
<kbd>M</kbd>: merge in met huidige checked out branch
<kbd>d</kbd>: verwijder branch
<kbd>r</kbd>: rebase branch
<kbd>u</kbd>: stel in als upstream van uitgecheckte branch
<kbd>enter</kbd>: bekijk commits
</pre>
## Branches Paneel (Remotes Tabblad)
@ -123,12 +124,9 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Commits Paneel (Commits)
<pre>
<kbd>c</kbd>: kopieer commit (cherry-pick)
<kbd>ctrl+o</kbd>: kopieer commit SHA naar klembord
<kbd>C</kbd>: kopieer commit reeks (cherry-pick)
<kbd>v</kbd>: plak commits (cherry-pick)
<kbd>n</kbd>: creëer nieuwe branch van commit
<kbd>ctrl+r</kbd>: reset cherry-picked (gekopieerde) commits selectie
<kbd>b</kbd>: view bisect options
<kbd>s</kbd>: squash beneden
<kbd>f</kbd>: Fixup commit
<kbd>r</kbd>: hernoem commit
@ -142,6 +140,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>ctrl+k</kbd>: verplaats commit 1 naar boven
<kbd>A</kbd>: wijzig commit met staged veranderingen
<kbd>t</kbd>: commit ongedaan maken
<kbd>n</kbd>: creëer nieuwe branch van commit
<kbd>c</kbd>: kopieer commit (cherry-pick)
<kbd>C</kbd>: kopieer commit reeks (cherry-pick)
<kbd>v</kbd>: plak commits (cherry-pick)
<kbd>ctrl+l</kbd>: open log menu
<kbd>g</kbd>: reset naar deze commit
<kbd>enter</kbd>: bekijk gecommite bestanden
@ -149,7 +151,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>T</kbd>: tag commit
<kbd>ctrl+y</kbd>: kopieer commit bericht naar klembord
<kbd>o</kbd>: open commit in browser
<kbd>b</kbd>: view bisect options
</pre>
## Commits Paneel (Reflog Tabblad)
@ -186,10 +187,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>S</kbd>: bekijk stash opties
<kbd>a</kbd>: toggle staged alle
<kbd>enter</kbd>: stage individuele hunks/lijnen
<kbd>:</kbd>: voor aangepaste commando uit
<kbd>g</kbd>: bekijk upstream reset opties
<kbd>`</kbd>: toggle bestandsboom weergave
<kbd>M</kbd>: open external merge tool (git mergetool)
<kbd>f</kbd>: fetch
</pre>
## Bestanden Paneel (Submodules)

View File

@ -20,6 +20,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>@</kbd>: open command log menu
<kbd>}</kbd>: Increase the size of the context shown around changes in the diff view
<kbd>{</kbd>: Decrease the size of the context shown around changes in the diff view
<kbd>:</kbd>: wykonaj własną komendę
<kbd>z</kbd>: undo (via reflog) (experimental)
<kbd>ctrl+z</kbd>: redo (via reflog) (experimental)
<kbd>P</kbd>: push
@ -41,6 +42,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Gałęzie Panel (Branches Tab)
<pre>
<kbd>i</kbd>: show git-flow options
<kbd>ctrl+o</kbd>: copy branch name to clipboard
<kbd>space</kbd>: przełącz
<kbd>o</kbd>: utwórz żądanie pobrania
<kbd>O</kbd>: utwórz opcje żądania ściągnięcia
@ -51,11 +54,9 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>d</kbd>: usuń gałąź
<kbd>r</kbd>: zmiana bazy gałęzi
<kbd>M</kbd>: scal do obecnej gałęzi
<kbd>i</kbd>: show git-flow options
<kbd>f</kbd>: fast-forward this branch from its upstream
<kbd>g</kbd>: wyświetl opcje resetu
<kbd>R</kbd>: rename branch
<kbd>ctrl+o</kbd>: copy branch name to clipboard
<kbd>enter</kbd>: view commits
</pre>
@ -64,13 +65,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<pre>
<kbd>esc</kbd>: wróć do listy repozytoriów zdalnych
<kbd>g</kbd>: wyświetl opcje resetu
<kbd>enter</kbd>: view commits
<kbd>space</kbd>: przełącz
<kbd>n</kbd>: nowa gałąź
<kbd>M</kbd>: scal do obecnej gałęzi
<kbd>d</kbd>: usuń gałąź
<kbd>r</kbd>: zmiana bazy gałęzi
<kbd>u</kbd>: set as upstream of checked-out branch
<kbd>enter</kbd>: view commits
</pre>
## Gałęzie Panel (Remotes Tab)
@ -122,12 +123,9 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## Commity Panel (Commity)
<pre>
<kbd>c</kbd>: kopiuj commit (przebieranie)
<kbd>ctrl+o</kbd>: copy commit SHA to clipboard
<kbd>C</kbd>: kopiuj zakres commitów (przebieranie)
<kbd>v</kbd>: wklej commity (przebieranie)
<kbd>n</kbd>: create new branch off of commit
<kbd>ctrl+r</kbd>: reset cherry-picked (copied) commits selection
<kbd>b</kbd>: view bisect options
<kbd>s</kbd>: ściśnij
<kbd>f</kbd>: napraw commit
<kbd>r</kbd>: zmień nazwę commita
@ -141,6 +139,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>ctrl+k</kbd>: przenieś commit 1 w górę
<kbd>A</kbd>: popraw commit zmianami z poczekalni
<kbd>t</kbd>: odwróć commit
<kbd>n</kbd>: create new branch off of commit
<kbd>c</kbd>: kopiuj commit (przebieranie)
<kbd>C</kbd>: kopiuj zakres commitów (przebieranie)
<kbd>v</kbd>: wklej commity (przebieranie)
<kbd>ctrl+l</kbd>: open log menu
<kbd>g</kbd>: zresetuj do tego commita
<kbd>enter</kbd>: przeglądaj pliki commita
@ -148,7 +150,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>T</kbd>: tag commit
<kbd>ctrl+y</kbd>: copy commit message to clipboard
<kbd>o</kbd>: open commit in browser
<kbd>b</kbd>: view bisect options
</pre>
## Commity Panel (Reflog Tab)
@ -173,7 +174,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<pre>
<kbd>D</kbd>: wyświetl opcje resetu
<kbd>f</kbd>: pobierz
<kbd>ctrl+o</kbd>: copy the file name to the clipboard
<kbd>ctrl+w</kbd>: Toggle whether or not whitespace changes are shown in the diff view
<kbd>space</kbd>: przełącz stan poczekalni
@ -191,10 +191,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>S</kbd>: wyświetl opcje schowka
<kbd>a</kbd>: przełącz stan poczekalni wszystkich
<kbd>enter</kbd>: zatwierdź pojedyncze linie
<kbd>:</kbd>: wykonaj własną komendę
<kbd>g</kbd>: view upstream reset options
<kbd>`</kbd>: toggle file tree view
<kbd>M</kbd>: open external merge tool (git mergetool)
<kbd>f</kbd>: pobierz
</pre>
## Pliki Panel (Submodules)

View File

@ -20,6 +20,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>@</kbd>: 打开命令日志菜单
<kbd>}</kbd>: Increase the size of the context shown around changes in the diff view
<kbd>{</kbd>: Decrease the size of the context shown around changes in the diff view
<kbd>:</kbd>: 执行自定义命令
<kbd>z</kbd>: (通过 reflog)撤销「实验功能」
<kbd>ctrl+z</kbd>: (通过 reflog)重做「实验功能」
<kbd>P</kbd>: 推送
@ -41,6 +42,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## 分支 面板 (分支标签)
<pre>
<kbd>i</kbd>: 显示 git-flow 选项
<kbd>ctrl+o</kbd>: 将分支名称复制到剪贴板
<kbd>space</kbd>: 检出
<kbd>o</kbd>: 创建抓取请求
<kbd>O</kbd>: 创建抓取请求选项
@ -51,11 +54,9 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>d</kbd>: 删除分支
<kbd>r</kbd>: 将已检出的分支变基到该分支
<kbd>M</kbd>: 合并到当前检出的分支
<kbd>i</kbd>: 显示 git-flow 选项
<kbd>f</kbd>: 从上游快进此分支
<kbd>g</kbd>: 查看重置选项
<kbd>R</kbd>: 重命名分支
<kbd>ctrl+o</kbd>: 将分支名称复制到剪贴板
<kbd>enter</kbd>: 查看提交
</pre>
@ -64,13 +65,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<pre>
<kbd>esc</kbd>: 返回远程仓库列表
<kbd>g</kbd>: 查看重置选项
<kbd>enter</kbd>: 查看提交
<kbd>space</kbd>: 检出
<kbd>n</kbd>: 新分支
<kbd>M</kbd>: 合并到当前检出的分支
<kbd>d</kbd>: 删除分支
<kbd>r</kbd>: 将已检出的分支变基到该分支
<kbd>u</kbd>: 设置为检出分支的上游
<kbd>enter</kbd>: 查看提交
</pre>
## 分支 面板 (远程页面)
@ -122,12 +123,9 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
## 提交 面板 (提交)
<pre>
<kbd>c</kbd>: 复制提交(拣选)
<kbd>ctrl+o</kbd>: 将提交的 SHA 复制到剪贴板
<kbd>C</kbd>: 复制提交范围(拣选)
<kbd>v</kbd>: 粘贴提交(拣选)
<kbd>n</kbd>: 从提交创建新分支
<kbd>ctrl+r</kbd>: 重置已拣选(复制)的提交
<kbd>b</kbd>: view bisect options
<kbd>s</kbd>: 向下压缩
<kbd>f</kbd>: 修正提交(fixup)
<kbd>r</kbd>: 改写提交
@ -141,6 +139,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>ctrl+k</kbd>: 上移提交
<kbd>A</kbd>: 用已暂存的更改来修补提交
<kbd>t</kbd>: 还原提交
<kbd>n</kbd>: 从提交创建新分支
<kbd>c</kbd>: 复制提交(拣选)
<kbd>C</kbd>: 复制提交范围(拣选)
<kbd>v</kbd>: 粘贴提交(拣选)
<kbd>ctrl+l</kbd>: open log menu
<kbd>g</kbd>: 重置为此提交
<kbd>enter</kbd>: 查看提交的文件
@ -148,7 +150,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>T</kbd>: 标签提交
<kbd>ctrl+y</kbd>: 将提交消息复制到剪贴板
<kbd>o</kbd>: open commit in browser
<kbd>b</kbd>: view bisect options
</pre>
## 提交 面板 (Reflog)
@ -173,7 +174,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<pre>
<kbd>D</kbd>: 查看重置选项
<kbd>f</kbd>: 抓取
<kbd>ctrl+o</kbd>: 将文件名复制到剪贴板
<kbd>ctrl+w</kbd>: 切换是否在差异视图中显示空白更改
<kbd>space</kbd>: 切换暂存状态
@ -191,10 +191,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>S</kbd>: 查看隐藏选项
<kbd>a</kbd>: 切换所有文件的暂存状态
<kbd>enter</kbd>: 暂存单个 块/行 用于文件, 或 折叠/展开 目录
<kbd>:</kbd>: 执行自定义命令
<kbd>g</kbd>: 查看上游重置选项
<kbd>`</kbd>: 切换文件树视图
<kbd>M</kbd>: 打开合并工具
<kbd>f</kbd>: 抓取
</pre>
## 文件 面板 (子模块)

View File

@ -124,7 +124,7 @@ func formatBinding(binding *types.Binding) string {
func getBindingSections(mApp *app.App) []*bindingSection {
bindingSections := []*bindingSection{}
bindings, _ := mApp.Gui.GetInitialKeybindings()
bindings := mApp.Gui.GetCheatsheetKeybindings()
type contextAndViewType struct {
subtitle string

View File

@ -11,3 +11,17 @@ type Helpers struct {
CherryPick *CherryPickHelper
Host *HostHelper
}
func NewStubHelpers() *Helpers {
return &Helpers{
Refs: &RefsHelper{},
Bisect: &BisectHelper{},
Suggestions: &SuggestionsHelper{},
Files: &FilesHelper{},
WorkingTree: &WorkingTreeHelper{},
Tags: &TagsHelper{},
MergeAndRebase: &MergeAndRebaseHelper{},
CherryPick: &CherryPickHelper{},
Host: &HostHelper{},
}
}

View File

@ -10,6 +10,7 @@ import (
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/constants"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@ -194,6 +195,16 @@ func (gui *Gui) noPopupPanel(f func() error) func() error {
}
}
// only to be called from the cheatsheet generate script. This mutates the Gui struct.
func (self *Gui) GetCheatsheetKeybindings() []*types.Binding {
self.helpers = helpers.NewStubHelpers()
self.State = &GuiRepoState{}
self.State.Contexts = self.contextTree()
self.resetControllers()
bindings, _ := self.GetInitialKeybindings()
return bindings
}
// renaming receiver to 'self' to aid refactoring. Will probably end up moving all Gui handlers to this pattern eventually.
func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding) {
config := self.c.UserConfig.Keybinding
@ -1306,8 +1317,6 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
func (gui *Gui) resetKeybindings() error {
gui.g.DeleteAllKeybindings()
bindings := gui.GetCustomCommandKeybindings()
bindings, mouseBindings := gui.GetInitialKeybindings()
// prepending because we want to give our custom keybindings precedence over default keybindings