mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-24 19:39:16 +02:00
Improve display of "esc" keybinding in the keybindings status bar (#4819)
### PR Description - For popup windows, the status bar would show `Confirm: <enter> | Close/Cancel: <esc> | Cancel: <esc>`. Omit the second `<esc>`. - Don't show the `<esc>` binding in other views when it doesn't do anything. - Change the text of the `<esc>` label to show what it does, based on context. This is very helpful because esc can cancel all sorts of things, and if several of these things are active at once, it is not obvious which one will be cancelled first. Supersedes #4808.
This commit is contained in:
@@ -24,12 +24,12 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| `` R `` | Refresh | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | Next screen mode (normal/half/fullscreen) | |
|
||||
| `` _ `` | Prev screen mode | |
|
||||
| `` <esc> `` | Cancel | |
|
||||
| `` ? `` | Open keybindings menu | |
|
||||
| `` <c-s> `` | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
| `` W `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` <c-e> `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` q `` | Quit | |
|
||||
| `` <esc> `` | Cancel | |
|
||||
| `` <c-w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` z `` | Undo | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
| `` <c-z> `` | Redo | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
@@ -256,7 +256,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | Execute | |
|
||||
| `` <esc> `` | Close | |
|
||||
| `` <esc> `` | Close/Cancel | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Reflog
|
||||
|
@@ -24,12 +24,12 @@ _凡例:`<c-b>` はctrl+b、`<a-b>` はalt+b、`B` はshift+bを意味
|
||||
| `` R `` | 更新 | Gitの状態を更新します(`git status`、`git branch`などをバックグラウンドで実行してパネルの内容を更新します)。これは`git fetch`を実行しません。 |
|
||||
| `` + `` | 次の画面モード(通常/半分/全画面) | |
|
||||
| `` _ `` | 前の画面モード | |
|
||||
| `` <esc> `` | キャンセル | |
|
||||
| `` ? `` | キーバインディングメニューを開く | |
|
||||
| `` <c-s> `` | フィルターオプションを表示 | コミットログのフィルタリングオプションを表示し、フィルタに一致するコミットのみを表示します。 |
|
||||
| `` W `` | 差分オプションを表示 | 2つのrefの差分に関連するオプションを表示します(例:選択したrefとの差分表示、差分を取るrefの入力、差分方向の反転など)。 |
|
||||
| `` <c-e> `` | 差分オプションを表示 | 2つのrefの差分に関連するオプションを表示します(例:選択したrefとの差分表示、差分を取るrefの入力、差分方向の反転など)。 |
|
||||
| `` q `` | 終了 | |
|
||||
| `` <esc> `` | キャンセル | |
|
||||
| `` <c-w> `` | 空白表示の切り替え | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` z `` | 元に戻す | 最後のgitコマンドを元に戻すために実行するgitコマンドを決定するためにreflogが使用されます。これにはワーキングツリーへの変更は含まれません。コミットのみが考慮されます。 |
|
||||
| `` <c-z> `` | やり直す | 最後のgitコマンドをやり直すために実行するgitコマンドを決定するためにreflogが使用されます。これにはワーキングツリーへの変更は含まれません。コミットのみが考慮されます。 |
|
||||
@@ -302,7 +302,7 @@ _凡例:`<c-b>` はctrl+b、`<a-b>` はalt+b、`B` はshift+bを意味
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | 実行 | |
|
||||
| `` <esc> `` | 閉じる | |
|
||||
| `` <esc> `` | 閉じる/キャンセル | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## リフログ
|
||||
|
@@ -24,12 +24,12 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| `` R `` | 새로고침 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | 다음 스크린 모드 (normal/half/fullscreen) | |
|
||||
| `` _ `` | 이전 스크린 모드 | |
|
||||
| `` <esc> `` | 취소 | |
|
||||
| `` ? `` | 매뉴 열기 | |
|
||||
| `` <c-s> `` | View filter-by-path options | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
| `` W `` | Diff 메뉴 열기 | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` <c-e> `` | Diff 메뉴 열기 | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` q `` | 종료 | |
|
||||
| `` <esc> `` | 취소 | |
|
||||
| `` <c-w> `` | 공백문자를 Diff 뷰에서 표시 여부 전환 | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` z `` | 되돌리기 (reflog) (실험적) | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
| `` <c-z> `` | 다시 실행 (reflog) (실험적) | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
@@ -128,7 +128,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | 실행 | |
|
||||
| `` <esc> `` | 닫기 | |
|
||||
| `` <esc> `` | 닫기/취소 | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## 메인 패널 (Merging)
|
||||
|
@@ -24,12 +24,12 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| `` R `` | Verversen | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | Volgende scherm modus (normaal/half/groot) | |
|
||||
| `` _ `` | Vorige scherm modus | |
|
||||
| `` <esc> `` | Annuleren | |
|
||||
| `` ? `` | Open menu | |
|
||||
| `` <c-s> `` | Bekijk scoping opties | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
| `` W `` | Open diff menu | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` <c-e> `` | Open diff menu | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` q `` | Quit | |
|
||||
| `` <esc> `` | Annuleren | |
|
||||
| `` <c-w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` z `` | Ongedaan maken (via reflog) (experimenteel) | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
| `` <c-z> `` | Redo (via reflog) (experimenteel) | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
|
@@ -24,12 +24,12 @@ _Legenda: `<c-b>` oznacza ctrl+b, `<a-b>` oznacza alt+b, `B` oznacza shift+b_
|
||||
| `` R `` | Odśwież | Odśwież stan git (tj. uruchom `git status`, `git branch`, itp. w tle, aby zaktualizować zawartość paneli). To nie uruchamia `git fetch`. |
|
||||
| `` + `` | Następny tryb ekranu (normalny/półpełny/pełnoekranowy) | |
|
||||
| `` _ `` | Poprzedni tryb ekranu | |
|
||||
| `` <esc> `` | Anuluj | |
|
||||
| `` ? `` | Otwórz menu przypisań klawiszy | |
|
||||
| `` <c-s> `` | Pokaż opcje filtrowania | Pokaż opcje filtrowania dziennika commitów, tak aby pokazywane były tylko commity pasujące do filtra. |
|
||||
| `` W `` | Pokaż opcje różnicowania | Pokaż opcje dotyczące różnicowania dwóch refów, np. różnicowanie względem wybranego refa, wprowadzanie refa do różnicowania i odwracanie kierunku różnic. |
|
||||
| `` <c-e> `` | Pokaż opcje różnicowania | Pokaż opcje dotyczące różnicowania dwóch refów, np. różnicowanie względem wybranego refa, wprowadzanie refa do różnicowania i odwracanie kierunku różnic. |
|
||||
| `` q `` | Wyjdź | |
|
||||
| `` <esc> `` | Anuluj | |
|
||||
| `` <c-w> `` | Przełącz białe znaki | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` z `` | Cofnij | Dziennik reflog zostanie użyty do określenia, jakie polecenie git należy uruchomić, aby cofnąć ostatnie polecenie git. Nie obejmuje to zmian w drzewie roboczym; brane są pod uwagę tylko commity. |
|
||||
| `` <c-z> `` | Ponów | Dziennik reflog zostanie użyty do określenia, jakie polecenie git należy uruchomić, aby ponowić ostatnie polecenie git. Nie obejmuje to zmian w drzewie roboczym; brane są pod uwagę tylko commity. |
|
||||
@@ -159,7 +159,7 @@ _Legenda: `<c-b>` oznacza ctrl+b, `<a-b>` oznacza alt+b, `B` oznacza shift+b_
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | Wykonaj | |
|
||||
| `` <esc> `` | Zamknij | |
|
||||
| `` <esc> `` | Zamknij/Anuluj | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
## Panel główny (normalny)
|
||||
|
@@ -24,12 +24,12 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| `` R `` | Atualizar | Atualize o estado do git (ou seja, execute `git status`, `git branch`, etc em segundo plano para atualizar o conteúdo de painéis). Isso não executa `git fetch`. |
|
||||
| `` + `` | Next screen mode (normal/half/fullscreen) | |
|
||||
| `` _ `` | Prev screen mode | |
|
||||
| `` <esc> `` | Cancelar | |
|
||||
| `` ? `` | Open keybindings menu | |
|
||||
| `` <c-s> `` | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
| `` W `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` <c-e> `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` q `` | Sair | |
|
||||
| `` <esc> `` | Cancelar | |
|
||||
| `` <c-w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` z `` | Desfazer | O reflog será usado para determinar qual comando git para executar para desfazer o último comando git. Isto não inclui mudanças na árvore de trabalho; apenas compromissos são tidos em consideração. |
|
||||
| `` <c-z> `` | Refazer | O reflog será usado para determinar qual comando git para executar para refazer o último comando git. Isto não inclui mudanças na árvore de trabalho; apenas compromissos são tidos em consideração. |
|
||||
@@ -221,7 +221,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | Executar | |
|
||||
| `` <esc> `` | Fechar | |
|
||||
| `` <esc> `` | Fechar/Cancelar | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Painel Principal (Normal)
|
||||
|
@@ -24,12 +24,12 @@ _Связки клавиш_
|
||||
| `` R `` | Обновить | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | Следующий режим экрана (нормальный/полуэкранный/полноэкранный) | |
|
||||
| `` _ `` | Предыдущий режим экрана | |
|
||||
| `` <esc> `` | Отменить | |
|
||||
| `` ? `` | Открыть меню | |
|
||||
| `` <c-s> `` | Просмотреть параметры фильтрации по пути | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
| `` W `` | Открыть меню сравнении | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` <c-e> `` | Открыть меню сравнении | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` q `` | Выйти | |
|
||||
| `` <esc> `` | Отменить | |
|
||||
| `` <c-w> `` | Переключить отображение изменении пробелов в просмотрщике сравнении | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` z `` | Отменить (через reflog) (экспериментальный) | Журнал ссылок (reflog) будет использоваться для определения того, какую команду git запустить, чтобы отменить последнюю команду git. Сюда не входят изменения в рабочем дереве; учитываются только коммиты. |
|
||||
| `` <c-z> `` | Повторить (через reflog) (экспериментальный) | Журнал ссылок (reflog) будет использоваться для определения того, какую команду git нужно запустить, чтобы повторить последнюю команду git. Сюда не входят изменения в рабочем дереве; учитываются только коммиты. |
|
||||
@@ -227,7 +227,7 @@ _Связки клавиш_
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | Выполнить | |
|
||||
| `` <esc> `` | Закрыть | |
|
||||
| `` <esc> `` | Закрыть/отменить | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Панель Подтверждения
|
||||
|
@@ -24,12 +24,12 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
|
||||
| `` R `` | 刷新 | 刷新git状态(即在后台上运行`git status`,`git branch`等命令以更新面板内容) 不会运行`git fetch` |
|
||||
| `` + `` | 下一屏模式(正常/半屏/全屏) | |
|
||||
| `` _ `` | 上一屏模式 | |
|
||||
| `` <esc> `` | 取消 | |
|
||||
| `` ? `` | 打开菜单 | |
|
||||
| `` <c-s> `` | 查看按路径过滤选项 | 查看用于过滤提交日志的选项,以便仅显示与过滤器匹配的提交。 |
|
||||
| `` W `` | 打开 diff 菜单 | 查看与比较两个引用相关的选项,例如与选定的 ref 进行比较,输入要比较的 ref,然后反转比较方向。 |
|
||||
| `` <c-e> `` | 打开 diff 菜单 | 查看与比较两个引用相关的选项,例如与选定的 ref 进行比较,输入要比较的 ref,然后反转比较方向。 |
|
||||
| `` q `` | 退出 | |
|
||||
| `` <esc> `` | 取消 | |
|
||||
| `` <c-w> `` | 切换是否在差异视图中显示空白字符差异 | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` z `` | 撤销 | Reflog将用于确定运行哪个git命令来撤消最后一个git命令。这并不包括对工作树的更改,只考虑提交。 |
|
||||
| `` <c-z> `` | 重做 | Reflog将用于确定运行哪个git命令来重做上一个git命令。这并不包括对工作树的更改,只考虑提交。 |
|
||||
|
@@ -24,12 +24,12 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B
|
||||
| `` R `` | 重新整理 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | 下一個螢幕模式(常規/半螢幕/全螢幕) | |
|
||||
| `` _ `` | 上一個螢幕模式 | |
|
||||
| `` <esc> `` | 取消 | |
|
||||
| `` ? `` | 開啟選單 | |
|
||||
| `` <c-s> `` | 檢視篩選路徑選項 | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
| `` W `` | 開啟差異比較選單 | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` <c-e> `` | 開啟差異比較選單 | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` q `` | 結束 | |
|
||||
| `` <esc> `` | 取消 | |
|
||||
| `` <c-w> `` | 切換是否在差異檢視中顯示空格變更 | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` z `` | 復原 | 將使用 reflog 確任 git 指令以復原。這不包括工作區更改;只考慮提交。 |
|
||||
| `` <c-z> `` | 取消復原 | 將使用 reflog 確任 git 指令以重作。這不包括工作區更改;只考慮提交。 |
|
||||
@@ -119,7 +119,7 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | 執行 | |
|
||||
| `` <esc> `` | 關閉 | |
|
||||
| `` <esc> `` | 關閉/取消 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 子提交
|
||||
|
@@ -58,6 +58,15 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
|
||||
Handler: opts.Guards.NoPopupPanel(self.prevScreenMode),
|
||||
Description: self.c.Tr.PrevScreenMode,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.escape,
|
||||
Description: self.c.Tr.Cancel,
|
||||
DescriptionFunc: self.escapeDescription,
|
||||
GetDisabledReason: self.escapeEnabled,
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.OptionMenu),
|
||||
@@ -114,13 +123,6 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.quitWithoutChangingDirectory,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.escape,
|
||||
Description: self.c.Tr.Cancel,
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.ToggleWhitespaceInDiffView),
|
||||
Handler: self.toggleWhitespace,
|
||||
@@ -190,6 +192,20 @@ func (self *GlobalController) escape() error {
|
||||
return (&QuitActions{c: self.c}).Escape()
|
||||
}
|
||||
|
||||
func (self *GlobalController) escapeDescription() string {
|
||||
return (&QuitActions{c: self.c}).EscapeDescription()
|
||||
}
|
||||
|
||||
func (self *GlobalController) escapeEnabled() *types.DisabledReason {
|
||||
if (&QuitActions{c: self.c}).EscapeEnabled() {
|
||||
return nil
|
||||
}
|
||||
|
||||
// The empty error text is intentional. We don't want to show an error
|
||||
// toast for this, but only hide it from the options map.
|
||||
return &types.DisabledReason{Text: ""}
|
||||
}
|
||||
|
||||
func (self *GlobalController) toggleWhitespace() error {
|
||||
return (&ToggleWhitespaceAction{c: self.c}).Call()
|
||||
}
|
||||
|
@@ -348,7 +348,7 @@ func (self *ConfirmationHelper) IsPopupPanelFocused() bool {
|
||||
|
||||
func (self *ConfirmationHelper) TooltipForMenuItem(menuItem *types.MenuItem) string {
|
||||
tooltip := menuItem.Tooltip
|
||||
if menuItem.DisabledReason != nil {
|
||||
if menuItem.DisabledReason != nil && menuItem.DisabledReason.Text != "" {
|
||||
if tooltip != "" {
|
||||
tooltip += "\n\n"
|
||||
}
|
||||
|
@@ -40,7 +40,8 @@ func NewModeHelper(
|
||||
|
||||
type ModeStatus struct {
|
||||
IsActive func() bool
|
||||
Description func() string
|
||||
InfoLabel func() string
|
||||
CancelLabel func() string
|
||||
Reset func() error
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ func (self *ModeHelper) Statuses() []ModeStatus {
|
||||
return []ModeStatus{
|
||||
{
|
||||
IsActive: self.c.Modes().Diffing.Active,
|
||||
Description: func() string {
|
||||
InfoLabel: func() string {
|
||||
return self.withResetButton(
|
||||
fmt.Sprintf(
|
||||
"%s %s",
|
||||
@@ -58,18 +59,24 @@ func (self *ModeHelper) Statuses() []ModeStatus {
|
||||
style.FgMagenta,
|
||||
)
|
||||
},
|
||||
CancelLabel: func() string {
|
||||
return self.c.Tr.CancelDiffingMode
|
||||
},
|
||||
Reset: self.diffHelper.ExitDiffMode,
|
||||
},
|
||||
{
|
||||
IsActive: self.c.Git().Patch.PatchBuilder.Active,
|
||||
Description: func() string {
|
||||
InfoLabel: func() string {
|
||||
return self.withResetButton(self.c.Tr.BuildingPatch, style.FgYellow.SetBold())
|
||||
},
|
||||
CancelLabel: func() string {
|
||||
return self.c.Tr.ExitCustomPatchBuilder
|
||||
},
|
||||
Reset: self.patchBuildingHelper.Reset,
|
||||
},
|
||||
{
|
||||
IsActive: self.c.Modes().Filtering.Active,
|
||||
Description: func() string {
|
||||
InfoLabel: func() string {
|
||||
filterContent := lo.Ternary(self.c.Modes().Filtering.GetPath() != "", self.c.Modes().Filtering.GetPath(), self.c.Modes().Filtering.GetAuthor())
|
||||
return self.withResetButton(
|
||||
fmt.Sprintf(
|
||||
@@ -80,21 +87,27 @@ func (self *ModeHelper) Statuses() []ModeStatus {
|
||||
style.FgRed,
|
||||
)
|
||||
},
|
||||
CancelLabel: func() string {
|
||||
return self.c.Tr.ExitFilterMode
|
||||
},
|
||||
Reset: self.ExitFilterMode,
|
||||
},
|
||||
{
|
||||
IsActive: self.c.Modes().MarkedBaseCommit.Active,
|
||||
Description: func() string {
|
||||
InfoLabel: func() string {
|
||||
return self.withResetButton(
|
||||
self.c.Tr.MarkedBaseCommitStatus,
|
||||
style.FgCyan,
|
||||
)
|
||||
},
|
||||
CancelLabel: func() string {
|
||||
return self.c.Tr.CancelMarkedBaseCommit
|
||||
},
|
||||
Reset: self.mergeAndRebaseHelper.ResetMarkedBaseCommit,
|
||||
},
|
||||
{
|
||||
IsActive: self.c.Modes().CherryPicking.Active,
|
||||
Description: func() string {
|
||||
InfoLabel: func() string {
|
||||
copiedCount := len(self.c.Modes().CherryPicking.CherryPickedCommits)
|
||||
text := self.c.Tr.CommitsCopied
|
||||
if copiedCount == 1 {
|
||||
@@ -110,27 +123,36 @@ func (self *ModeHelper) Statuses() []ModeStatus {
|
||||
style.FgCyan,
|
||||
)
|
||||
},
|
||||
CancelLabel: func() string {
|
||||
return self.c.Tr.ResetCherryPickShort
|
||||
},
|
||||
Reset: self.cherryPickHelper.Reset,
|
||||
},
|
||||
{
|
||||
IsActive: func() bool {
|
||||
return !self.suppressRebasingMode && self.c.Git().Status.WorkingTreeState().Any()
|
||||
},
|
||||
Description: func() string {
|
||||
InfoLabel: func() string {
|
||||
workingTreeState := self.c.Git().Status.WorkingTreeState()
|
||||
return self.withResetButton(
|
||||
workingTreeState.Title(self.c.Tr), style.FgYellow,
|
||||
)
|
||||
},
|
||||
CancelLabel: func() string {
|
||||
return fmt.Sprintf(self.c.Tr.AbortTitle, self.c.Git().Status.WorkingTreeState().CommandName())
|
||||
},
|
||||
Reset: self.mergeAndRebaseHelper.AbortMergeOrRebaseWithConfirm,
|
||||
},
|
||||
{
|
||||
IsActive: func() bool {
|
||||
return self.c.Model().BisectInfo.Started()
|
||||
},
|
||||
Description: func() string {
|
||||
InfoLabel: func() string {
|
||||
return self.withResetButton(self.c.Tr.Bisect.Bisecting, style.FgGreen)
|
||||
},
|
||||
CancelLabel: func() string {
|
||||
return self.c.Tr.Actions.ResetBisect
|
||||
},
|
||||
Reset: self.bisectHelper.Reset,
|
||||
},
|
||||
}
|
||||
|
@@ -39,9 +39,10 @@ func (self *MainViewController) GetKeybindings(opts types.KeybindingsOpts) []*ty
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Handler: self.escape,
|
||||
Description: self.c.Tr.ExitFocusedMainView,
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Handler: self.escape,
|
||||
Description: self.c.Tr.ExitFocusedMainView,
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
{
|
||||
// overriding this because we want to read all of the task's output before we start searching
|
||||
|
@@ -47,7 +47,7 @@ func (self *MenuController) GetKeybindings(opts types.KeybindingsOpts) []*types.
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Handler: self.close,
|
||||
Description: self.c.Tr.Close,
|
||||
Description: self.c.Tr.CloseCancel,
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
}
|
||||
|
@@ -43,9 +43,11 @@ func (self *PatchBuildingController) GetKeybindings(opts types.KeybindingsOpts)
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Handler: self.Escape,
|
||||
Description: self.c.Tr.ExitCustomPatchBuilder,
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Handler: self.Escape,
|
||||
Description: self.c.Tr.ExitCustomPatchBuilder,
|
||||
DescriptionFunc: self.EscapeDescription,
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -179,3 +181,18 @@ func (self *PatchBuildingController) Escape() error {
|
||||
self.c.Helpers().PatchBuilding.Escape()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *PatchBuildingController) EscapeDescription() string {
|
||||
context := self.c.Contexts().CustomPatchBuilder
|
||||
if state := context.GetState(); state != nil {
|
||||
if state.SelectingRange() {
|
||||
return self.c.Tr.DismissRangeSelect
|
||||
}
|
||||
|
||||
if state.SelectingHunkEnabledByUser() {
|
||||
return self.c.Tr.SelectLineByLine
|
||||
}
|
||||
}
|
||||
|
||||
return self.c.Tr.ExitCustomPatchBuilder
|
||||
}
|
||||
|
@@ -48,6 +48,8 @@ func (self *QuitActions) confirmQuitDuringUpdate() error {
|
||||
}
|
||||
|
||||
func (self *QuitActions) Escape() error {
|
||||
// If you make changes to this function, be sure to update EscapeEnabled and EscapeDescription accordingly.
|
||||
|
||||
currentContext := self.c.Context().Current()
|
||||
|
||||
if listContext, ok := currentContext.(types.IListContext); ok {
|
||||
@@ -58,17 +60,12 @@ func (self *QuitActions) Escape() error {
|
||||
}
|
||||
}
|
||||
|
||||
switch ctx := currentContext.(type) {
|
||||
case types.IFilterableContext:
|
||||
// Cancelling searching (as opposed to filtering) is handled by gocui
|
||||
if ctx, ok := currentContext.(types.IFilterableContext); ok {
|
||||
if ctx.IsFiltering() {
|
||||
self.c.Helpers().Search.Cancel()
|
||||
return nil
|
||||
}
|
||||
case types.ISearchableContext:
|
||||
if ctx.IsSearching() {
|
||||
self.c.Helpers().Search.Cancel()
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
parentContext := currentContext.GetParentContext()
|
||||
@@ -95,3 +92,79 @@ func (self *QuitActions) Escape() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *QuitActions) EscapeEnabled() bool {
|
||||
currentContext := self.c.Context().Current()
|
||||
|
||||
if listContext, ok := currentContext.(types.IListContext); ok {
|
||||
if listContext.GetList().IsSelectingRange() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if ctx, ok := currentContext.(types.IFilterableContext); ok {
|
||||
if ctx.IsFiltering() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
parentContext := currentContext.GetParentContext()
|
||||
if parentContext != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, mode := range self.c.Helpers().Mode.Statuses() {
|
||||
if mode.IsActive() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
repoPathStack := self.c.State().GetRepoPathStack()
|
||||
if !repoPathStack.IsEmpty() {
|
||||
return true
|
||||
}
|
||||
|
||||
if self.c.UserConfig().QuitOnTopLevelReturn {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (self *QuitActions) EscapeDescription() string {
|
||||
currentContext := self.c.Context().Current()
|
||||
|
||||
if listContext, ok := currentContext.(types.IListContext); ok {
|
||||
if listContext.GetList().IsSelectingRange() {
|
||||
return self.c.Tr.DismissRangeSelect
|
||||
}
|
||||
}
|
||||
|
||||
if ctx, ok := currentContext.(types.IFilterableContext); ok {
|
||||
if ctx.IsFiltering() {
|
||||
return self.c.Tr.ExitFilterMode
|
||||
}
|
||||
}
|
||||
|
||||
parentContext := currentContext.GetParentContext()
|
||||
if parentContext != nil {
|
||||
return self.c.Tr.ExitSubview
|
||||
}
|
||||
|
||||
for _, mode := range self.c.Helpers().Mode.Statuses() {
|
||||
if mode.IsActive() {
|
||||
return mode.CancelLabel()
|
||||
}
|
||||
}
|
||||
|
||||
repoPathStack := self.c.State().GetRepoPathStack()
|
||||
if !repoPathStack.IsEmpty() {
|
||||
return self.c.Tr.BackToParentRepo
|
||||
}
|
||||
|
||||
if self.c.UserConfig().QuitOnTopLevelReturn {
|
||||
return self.c.Tr.Quit
|
||||
}
|
||||
|
||||
return self.c.Tr.Cancel
|
||||
}
|
||||
|
@@ -68,9 +68,11 @@ func (self *StagingController) GetKeybindings(opts types.KeybindingsOpts) []*typ
|
||||
Tooltip: self.c.Tr.EditFileTooltip,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Handler: self.Escape,
|
||||
Description: self.c.Tr.ReturnToFilesPanel,
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
Handler: self.Escape,
|
||||
Description: self.c.Tr.ReturnToFilesPanel,
|
||||
DescriptionFunc: self.EscapeDescription,
|
||||
DisplayOnScreen: true,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
||||
@@ -178,6 +180,20 @@ func (self *StagingController) Escape() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *StagingController) EscapeDescription() string {
|
||||
if state := self.context.GetState(); state != nil {
|
||||
if state.SelectingRange() {
|
||||
return self.c.Tr.DismissRangeSelect
|
||||
}
|
||||
|
||||
if state.SelectingHunkEnabledByUser() {
|
||||
return self.c.Tr.SelectLineByLine
|
||||
}
|
||||
}
|
||||
|
||||
return self.c.Tr.ReturnToFilesPanel
|
||||
}
|
||||
|
||||
func (self *StagingController) TogglePanel() error {
|
||||
if self.otherContext.GetState() != nil {
|
||||
self.c.Context().Push(self.otherContext, types.OnFocusOpts{})
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
func (gui *Gui) informationStr() string {
|
||||
if activeMode, ok := gui.helpers.Mode.GetActiveMode(); ok {
|
||||
return activeMode.Description()
|
||||
return activeMode.InfoLabel()
|
||||
}
|
||||
|
||||
if gui.g.Mouse {
|
||||
|
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/generics/set"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/keybindings"
|
||||
@@ -38,7 +39,14 @@ func (self *OptionsMapMgr) renderContextOptionsMap() {
|
||||
currentContextBindings := currentContext.GetKeybindings(self.c.KeybindingsOpts())
|
||||
globalBindings := self.c.Contexts().Global.GetKeybindings(self.c.KeybindingsOpts())
|
||||
|
||||
allBindings := append(currentContextBindings, globalBindings...)
|
||||
currentContextKeys := set.NewFromSlice(
|
||||
lo.Map(currentContextBindings, func(binding *types.Binding, _ int) types.Key {
|
||||
return binding.Key
|
||||
}))
|
||||
|
||||
allBindings := append(currentContextBindings, lo.Filter(globalBindings, func(b *types.Binding, _ int) bool {
|
||||
return !currentContextKeys.Includes(b.Key)
|
||||
})...)
|
||||
|
||||
bindingsToDisplay := lo.Filter(allBindings, func(binding *types.Binding, _ int) bool {
|
||||
return binding.DisplayOnScreen && !binding.IsDisabled()
|
||||
|
@@ -601,6 +601,7 @@ type TranslationSet struct {
|
||||
RenameBranchWarning string
|
||||
OpenKeybindingsMenu string
|
||||
ResetCherryPick string
|
||||
ResetCherryPickShort string
|
||||
NextTab string
|
||||
PrevTab string
|
||||
CantUndoWhileRebasing string
|
||||
@@ -634,6 +635,7 @@ type TranslationSet struct {
|
||||
SwapDiff string
|
||||
ViewDiffingOptions string
|
||||
ViewDiffingOptionsTooltip string
|
||||
CancelDiffingMode string
|
||||
OpenCommandLogMenu string
|
||||
OpenCommandLogMenuTooltip string
|
||||
ShowingGitDiff string
|
||||
@@ -671,6 +673,7 @@ type TranslationSet struct {
|
||||
SubmoduleStashAndReset string
|
||||
AndResetSubmodules string
|
||||
EnterSubmoduleTooltip string
|
||||
BackToParentRepo string
|
||||
Enter string
|
||||
CopySubmoduleNameToClipboard string
|
||||
RemoveSubmodule string
|
||||
@@ -699,6 +702,7 @@ type TranslationSet struct {
|
||||
BulkSubmoduleOptions string
|
||||
RunningCommand string
|
||||
SubCommitsTitle string
|
||||
ExitSubview string
|
||||
SubmodulesTitle string
|
||||
NavigationTitle string
|
||||
SuggestionsCheatsheetTitle string
|
||||
@@ -861,6 +865,7 @@ type TranslationSet struct {
|
||||
MarkedBaseCommitStatus string
|
||||
MarkAsBaseCommit string
|
||||
MarkAsBaseCommitTooltip string
|
||||
CancelMarkedBaseCommit string
|
||||
MarkedCommitMarker string
|
||||
FailedToOpenURL string
|
||||
InvalidLazygitEditURL string
|
||||
@@ -870,6 +875,7 @@ type TranslationSet struct {
|
||||
QuickStartInteractiveRebaseTooltip string
|
||||
CannotQuickStartInteractiveRebase string
|
||||
ToggleRangeSelect string
|
||||
DismissRangeSelect string
|
||||
RangeSelectUp string
|
||||
RangeSelectDown string
|
||||
RangeSelectNotSupported string
|
||||
@@ -1349,6 +1355,7 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
DiscardSelection: `Discard`,
|
||||
DiscardSelectionTooltip: "When unstaged change is selected, discard the change using `git reset`. When staged change is selected, unstage the change.",
|
||||
ToggleRangeSelect: "Toggle range select",
|
||||
DismissRangeSelect: "Dismiss range select",
|
||||
ToggleSelectHunk: "Toggle hunk selection",
|
||||
SelectHunk: "Select hunks",
|
||||
SelectLineByLine: "Select line-by-line",
|
||||
@@ -1667,6 +1674,7 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
RenameBranchWarning: "This branch is tracking a remote. This action will only rename the local branch name, not the name of the remote branch. Continue?",
|
||||
OpenKeybindingsMenu: "Open keybindings menu",
|
||||
ResetCherryPick: "Reset copied (cherry-picked) commits selection",
|
||||
ResetCherryPickShort: "Reset copied commits",
|
||||
NextTab: "Next tab",
|
||||
PrevTab: "Previous tab",
|
||||
CantUndoWhileRebasing: "Can't undo while rebasing",
|
||||
@@ -1700,6 +1708,7 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
SwapDiff: "Reverse diff direction",
|
||||
ViewDiffingOptions: "View diffing options",
|
||||
ViewDiffingOptionsTooltip: "View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction.",
|
||||
CancelDiffingMode: "Cancel diffing mode",
|
||||
// the actual view is the extras view which I intend to give more tabs in future but for now we'll only mention the command log part
|
||||
OpenCommandLogMenu: "View command log options",
|
||||
OpenCommandLogMenuTooltip: "View options for the command log e.g. show/hide the command log and focus the command log.",
|
||||
@@ -1739,6 +1748,7 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
AndResetSubmodules: "And reset submodules",
|
||||
Enter: "Enter",
|
||||
EnterSubmoduleTooltip: "Enter submodule. After entering the submodule, you can press `{{.escape}}` to escape back to the parent repo.",
|
||||
BackToParentRepo: "Back to parent repo",
|
||||
CopySubmoduleNameToClipboard: "Copy submodule name to clipboard",
|
||||
RemoveSubmodule: "Remove submodule",
|
||||
RemoveSubmodulePrompt: "Are you sure you want to remove submodule '%s' and its corresponding directory? This is irreversible.",
|
||||
@@ -1766,6 +1776,7 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
BulkSubmoduleOptions: "Bulk submodule options",
|
||||
RunningCommand: "Running command",
|
||||
SubCommitsTitle: "Sub-commits",
|
||||
ExitSubview: "Exit subview",
|
||||
SubmodulesTitle: "Submodules",
|
||||
NavigationTitle: "List panel navigation",
|
||||
SuggestionsCheatsheetTitle: "Suggestions",
|
||||
@@ -1925,6 +1936,7 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
MarkedBaseCommitStatus: "Marked a base commit for rebase",
|
||||
MarkAsBaseCommit: "Mark as base commit for rebase",
|
||||
MarkAsBaseCommitTooltip: "Select a base commit for the next rebase. When you rebase onto a branch, only commits above the base commit will be brought across. This uses the `git rebase --onto` command.",
|
||||
CancelMarkedBaseCommit: "Cancel marked base commit",
|
||||
MarkedCommitMarker: "↑↑↑ Will rebase from here ↑↑↑",
|
||||
FailedToOpenURL: "Failed to open URL %s\n\nError: %v",
|
||||
InvalidLazygitEditURL: "Invalid lazygit-edit URL format: %s",
|
||||
|
@@ -31,12 +31,12 @@ var KeybindingSuggestionsWhenSwitchingRepos = NewIntegrationTest(NewIntegrationT
|
||||
|
||||
t.Views().Files().Focus()
|
||||
t.Views().Options().Content(
|
||||
Equals("Commit: c | Stash: s | Reset: D | Keybindings: ? | Cancel: <esc>"))
|
||||
Equals("Commit: c | Stash: s | Reset: D | Keybindings: ?"))
|
||||
|
||||
switchToRepo("other")
|
||||
switchToRepo("repo")
|
||||
|
||||
t.Views().Options().Content(
|
||||
Equals("Commit: c | Stash: s | Reset: D | Keybindings: ? | Cancel: <esc>"))
|
||||
Equals("Commit: c | Stash: s | Reset: D | Keybindings: ?"))
|
||||
},
|
||||
})
|
||||
|
Reference in New Issue
Block a user