Skip to content

Commit ff0a16f

Browse files
committed
Fix keybinding cheatsheets with regard to pipe characters in key or description
The "Cycle pagers" command wasn't rendered correctly, because it's bound to '|' by default, but this was taked as a table column delimiter. Fix this by escaping the pipe character. A similar thing could happen for the description or tooltip (and did in fact, for a tooltip in the russion translation), so escape those too just to be sure.
1 parent 48c1db6 commit ff0a16f

File tree

10 files changed

+17
-12
lines changed

10 files changed

+17
-12
lines changed

docs/keybindings/Keybindings_en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
2424
| `` 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`. |
2525
| `` + `` | Next screen mode (normal/half/fullscreen) | |
2626
| `` _ `` | Prev screen mode | |
27-
| `` | `` | Cycle pagers | Choose the next pager in the list of configured pagers |
27+
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
2828
| `` <esc> `` | Cancel | |
2929
| `` ? `` | Open keybindings menu | |
3030
| `` <c-s> `` | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. |

docs/keybindings/Keybindings_ja.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _凡例:`<c-b>` はctrl+b、`<a-b>` はalt+b、`B` はshift+bを意味
2424
| `` R `` | 更新 | Gitの状態を更新します(`git status``git branch`などをバックグラウンドで実行してパネルの内容を更新します)。これは`git fetch`を実行しません。 |
2525
| `` + `` | 次の画面モード(通常/半分/全画面) | |
2626
| `` _ `` | 前の画面モード | |
27-
| `` | `` | Cycle pagers | Choose the next pager in the list of configured pagers |
27+
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
2828
| `` <esc> `` | キャンセル | |
2929
| `` ? `` | キーバインディングメニューを開く | |
3030
| `` <c-s> `` | フィルターオプションを表示 | コミットログのフィルタリングオプションを表示し、フィルタに一致するコミットのみを表示します。 |

docs/keybindings/Keybindings_ko.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
2424
| `` 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`. |
2525
| `` + `` | 다음 스크린 모드 (normal/half/fullscreen) | |
2626
| `` _ `` | 이전 스크린 모드 | |
27-
| `` | `` | Cycle pagers | Choose the next pager in the list of configured pagers |
27+
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
2828
| `` <esc> `` | 취소 | |
2929
| `` ? `` | 매뉴 열기 | |
3030
| `` <c-s> `` | View filter-by-path options | View options for filtering the commit log, so that only commits matching the filter are shown. |

docs/keybindings/Keybindings_nl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
2424
| `` 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`. |
2525
| `` + `` | Volgende scherm modus (normaal/half/groot) | |
2626
| `` _ `` | Vorige scherm modus | |
27-
| `` | `` | Cycle pagers | Choose the next pager in the list of configured pagers |
27+
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
2828
| `` <esc> `` | Annuleren | |
2929
| `` ? `` | Open menu | |
3030
| `` <c-s> `` | Bekijk scoping opties | View options for filtering the commit log, so that only commits matching the filter are shown. |

docs/keybindings/Keybindings_pl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _Legenda: `<c-b>` oznacza ctrl+b, `<a-b>` oznacza alt+b, `B` oznacza shift+b_
2424
| `` 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`. |
2525
| `` + `` | Następny tryb ekranu (normalny/półpełny/pełnoekranowy) | |
2626
| `` _ `` | Poprzedni tryb ekranu | |
27-
| `` | `` | Cycle pagers | Choose the next pager in the list of configured pagers |
27+
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
2828
| `` <esc> `` | Anuluj | |
2929
| `` ? `` | Otwórz menu przypisań klawiszy | |
3030
| `` <c-s> `` | Pokaż opcje filtrowania | Pokaż opcje filtrowania dziennika commitów, tak aby pokazywane były tylko commity pasujące do filtra. |

docs/keybindings/Keybindings_pt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
2424
| `` 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`. |
2525
| `` + `` | Next screen mode (normal/half/fullscreen) | |
2626
| `` _ `` | Prev screen mode | |
27-
| `` | `` | Cycle pagers | Choose the next pager in the list of configured pagers |
27+
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
2828
| `` <esc> `` | Cancelar | |
2929
| `` ? `` | Open keybindings menu | |
3030
| `` <c-s> `` | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. |

docs/keybindings/Keybindings_ru.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _Связки клавиш_
2424
| `` 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`. |
2525
| `` + `` | Следующий режим экрана (нормальный/полуэкранный/полноэкранный) | |
2626
| `` _ `` | Предыдущий режим экрана | |
27-
| `` | `` | Cycle pagers | Choose the next pager in the list of configured pagers |
27+
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
2828
| `` <esc> `` | Отменить | |
2929
| `` ? `` | Открыть меню | |
3030
| `` <c-s> `` | Просмотреть параметры фильтрации по пути | View options for filtering the commit log, so that only commits matching the filter are shown. |
@@ -153,7 +153,7 @@ _Связки клавиш_
153153
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
154154
| `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. |
155155
| `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
156-
| `` <c-r> `` | Сбросить отобранную (скопированную | cherry-picked) выборку коммитов | |
156+
| `` <c-r> `` | Сбросить отобранную (скопированную \| cherry-picked) выборку коммитов | |
157157
| `` <c-t> `` | Open external diff tool (git difftool) | |
158158
| `` * `` | Select commits of current branch | |
159159
| `` 0 `` | Focus main view | |
@@ -166,7 +166,7 @@ _Связки клавиш_
166166
| Key | Action | Info |
167167
|-----|--------|-------------|
168168
| `` <c-o> `` | Скопировать hash коммита в буфер обмена | |
169-
| `` <c-r> `` | Сбросить отобранную (скопированную | cherry-picked) выборку коммитов | |
169+
| `` <c-r> `` | Сбросить отобранную (скопированную \| cherry-picked) выборку коммитов | |
170170
| `` b `` | Просмотреть параметры бинарного поиска | |
171171
| `` s `` | Объединить коммиты (Squash) | Squash the selected commit into the commit below it. The selected commit's message will be appended to the commit below it. |
172172
| `` f `` | Объединить несколько коммитов в один отбросив сообщение коммита (Fixup) | Meld the selected commit into the commit below it. Similar to squash, but the selected commit's message will be discarded. |
@@ -259,7 +259,7 @@ _Связки клавиш_
259259
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
260260
| `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. |
261261
| `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
262-
| `` <c-r> `` | Сбросить отобранную (скопированную | cherry-picked) выборку коммитов | |
262+
| `` <c-r> `` | Сбросить отобранную (скопированную \| cherry-picked) выборку коммитов | |
263263
| `` <c-t> `` | Open external diff tool (git difftool) | |
264264
| `` * `` | Select commits of current branch | |
265265
| `` 0 `` | Focus main view | |

docs/keybindings/Keybindings_zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
2424
| `` R `` | 刷新 | 刷新git状态(即在后台上运行`git status`,`git branch`等命令以更新面板内容) 不会运行`git fetch` |
2525
| `` + `` | 下一屏模式(正常/半屏/全屏) | |
2626
| `` _ `` | 上一屏模式 | |
27-
| `` | `` | Cycle pagers | Choose the next pager in the list of configured pagers |
27+
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
2828
| `` <esc> `` | 取消 | |
2929
| `` ? `` | 打开菜单 | |
3030
| `` <c-s> `` | 查看按路径过滤选项 | 查看用于过滤提交日志的选项,以便仅显示与过滤器匹配的提交。 |

docs/keybindings/Keybindings_zh-TW.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B
2424
| `` 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`. |
2525
| `` + `` | 下一個螢幕模式(常規/半螢幕/全螢幕) | |
2626
| `` _ `` | 上一個螢幕模式 | |
27-
| `` | `` | Cycle pagers | Choose the next pager in the list of configured pagers |
27+
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
2828
| `` <esc> `` | 取消 | |
2929
| `` ? `` | 開啟選單 | |
3030
| `` <c-s> `` | 檢視篩選路徑選項 | View options for filtering the commit log, so that only commits matching the filter are shown. |

pkg/cheatsheet/generate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ func formatBinding(binding *types.Binding) string {
225225
// Replace newlines with <br> tags for proper markdown table formatting
226226
tooltip := strings.ReplaceAll(binding.Tooltip, "\n", "<br>")
227227

228+
// Escape pipe characters to avoid breaking the table format
229+
action = strings.ReplaceAll(action, `|`, `\|`)
230+
description = strings.ReplaceAll(description, `|`, `\|`)
231+
tooltip = strings.ReplaceAll(tooltip, `|`, `\|`)
232+
228233
// Use backticks for keyboard keys. Two backticks are needed with an inner space
229234
// to escape a key that is itself a backtick.
230235
return fmt.Sprintf("| `` %s `` | %s | %s |\n", action, description, tooltip)

0 commit comments

Comments
 (0)