diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2024-01-13 17:40:28 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2024-01-19 10:50:49 +1100 |
commit | 280b4d60f893a0e20897091ab02617c32180b45d (patch) | |
tree | 9665a327ae7fe4d468637fc0e10327a223a113ed | |
parent | 54bd94ad24ca24ca12fab59e9dbf0d79fe7681da (diff) |
Support select range for cherry pick
This requires us to change the 'v' keybinding for paste to something else,
now that 'v' is used globally for toggling range select. So I'm using
'shift+v' and I'm likewise changing 'c' to 'shift+c' for copying, so
that they're consistent.
We will need to clearly communicate this change in keybindings.
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | docs/Config.md | 5 | ||||
-rw-r--r-- | docs/keybindings/Keybindings_en.md | 11 | ||||
-rw-r--r-- | docs/keybindings/Keybindings_ja.md | 11 | ||||
-rw-r--r-- | docs/keybindings/Keybindings_ko.md | 11 | ||||
-rw-r--r-- | docs/keybindings/Keybindings_nl.md | 11 | ||||
-rw-r--r-- | docs/keybindings/Keybindings_pl.md | 11 | ||||
-rw-r--r-- | docs/keybindings/Keybindings_ru.md | 11 | ||||
-rw-r--r-- | docs/keybindings/Keybindings_zh-CN.md | 11 | ||||
-rw-r--r-- | docs/keybindings/Keybindings_zh-TW.md | 11 | ||||
-rw-r--r-- | pkg/config/user_config.go | 6 | ||||
-rw-r--r-- | pkg/gui/controllers/basic_commits_controller.go | 14 | ||||
-rw-r--r-- | pkg/gui/controllers/helpers/cherry_pick_helper.go | 30 | ||||
-rw-r--r-- | pkg/i18n/chinese.go | 1 | ||||
-rw-r--r-- | pkg/i18n/dutch.go | 1 | ||||
-rw-r--r-- | pkg/i18n/english.go | 2 | ||||
-rw-r--r-- | pkg/i18n/japanese.go | 5 | ||||
-rw-r--r-- | pkg/i18n/korean.go | 1 | ||||
-rw-r--r-- | pkg/i18n/polish.go | 1 | ||||
-rw-r--r-- | pkg/i18n/russian.go | 1 | ||||
-rw-r--r-- | pkg/i18n/traditional_chinese.go | 1 | ||||
-rw-r--r-- | pkg/integration/tests/cherry_pick/cherry_pick_range.go | 85 | ||||
-rw-r--r-- | pkg/integration/tests/test_list.go | 1 | ||||
-rw-r--r-- | schema/config.json | 8 |
24 files changed, 148 insertions, 104 deletions
@@ -122,7 +122,7 @@ You can also perform any these actions as a once-off (e.g. pressing `s` on a com ### Cherry-pick -Press `c` on a commit to copy it and press `v` to paste (cherry-pick) it. +Press `shift+c` on a commit to copy it and press `shift+v` to paste (cherry-pick) it. ![cherry_pick](../assets/demo/cherry_pick-compressed.gif) diff --git a/docs/Config.md b/docs/Config.md index 966fce0f4..dde60382a 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -249,9 +249,8 @@ keybinding: amendToCommit: 'A' pickCommit: 'p' # pick commit (when mid-rebase) revertCommit: 't' - cherryPickCopy: 'c' - cherryPickCopyRange: 'C' - pasteCommits: 'v' + cherryPickCopy: 'C' + pasteCommits: 'V' tagCommit: 'T' checkoutCommit: '<space>' resetCherryPick: '<c-R>' diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index b96d22ec6..04db47490 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -88,7 +88,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>S</kbd>: Squash all 'fixup!' commits above selected commit (autosquash) <kbd><c-j></kbd>: Move commit down one <kbd><c-k></kbd>: Move commit up one - <kbd>v</kbd>: Paste commits (cherry-pick) + <kbd>V</kbd>: Paste commits (cherry-pick) <kbd>B</kbd>: Mark commit as base commit for rebase <kbd>A</kbd>: Amend commit with staged changes <kbd>a</kbd>: Set/Reset commit author @@ -101,8 +101,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: Open commit in browser <kbd>n</kbd>: Create new branch off of commit <kbd>g</kbd>: View reset options - <kbd>c</kbd>: Copy commit (cherry-pick) - <kbd>C</kbd>: Copy commit range (cherry-pick) + <kbd>C</kbd>: Copy commit (cherry-pick) <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: View selected item's files <kbd>/</kbd>: Search the current view by text @@ -248,8 +247,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: Open commit in browser <kbd>n</kbd>: Create new branch off of commit <kbd>g</kbd>: View reset options - <kbd>c</kbd>: Copy commit (cherry-pick) - <kbd>C</kbd>: Copy commit range (cherry-pick) + <kbd>C</kbd>: Copy commit (cherry-pick) <kbd><c-r></kbd>: Reset cherry-picked (copied) commits selection <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: View commits @@ -316,8 +314,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: Open commit in browser <kbd>n</kbd>: Create new branch off of commit <kbd>g</kbd>: View reset options - <kbd>c</kbd>: Copy commit (cherry-pick) - <kbd>C</kbd>: Copy commit range (cherry-pick) + <kbd>C</kbd>: Copy commit (cherry-pick) <kbd><c-r></kbd>: Reset cherry-picked (copied) commits selection <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: View selected item's files diff --git a/docs/keybindings/Keybindings_ja.md b/docs/keybindings/Keybindings_ja.md index 4365e3685..3f7f9fb01 100644 --- a/docs/keybindings/Keybindings_ja.md +++ b/docs/keybindings/Keybindings_ja.md @@ -70,8 +70,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: ブラウザでコミットを開く <kbd>n</kbd>: コミットにブランチを作成 <kbd>g</kbd>: View reset options - <kbd>c</kbd>: コミットをコピー (cherry-pick) - <kbd>C</kbd>: コミットを範囲コピー (cherry-pick) + <kbd>C</kbd>: コミットをコピー (cherry-pick) <kbd><c-r></kbd>: Reset cherry-picked (copied) commits selection <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: View selected item's files @@ -107,7 +106,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>S</kbd>: Squash all 'fixup!' commits above selected commit (autosquash) <kbd><c-j></kbd>: コミットを1つ下に移動 <kbd><c-k></kbd>: コミットを1つ上に移動 - <kbd>v</kbd>: コミットを貼り付け (cherry-pick) + <kbd>V</kbd>: コミットを貼り付け (cherry-pick) <kbd>B</kbd>: Mark commit as base commit for rebase <kbd>A</kbd>: ステージされた変更でamendコミット <kbd>a</kbd>: Set/Reset commit author @@ -120,8 +119,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: ブラウザでコミットを開く <kbd>n</kbd>: コミットにブランチを作成 <kbd>g</kbd>: View reset options - <kbd>c</kbd>: コミットをコピー (cherry-pick) - <kbd>C</kbd>: コミットを範囲コピー (cherry-pick) + <kbd>C</kbd>: コミットをコピー (cherry-pick) <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: View selected item's files <kbd>/</kbd>: 検索を開始 @@ -348,8 +346,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: ブラウザでコミットを開く <kbd>n</kbd>: コミットにブランチを作成 <kbd>g</kbd>: View reset options - <kbd>c</kbd>: コミットをコピー (cherry-pick) - <kbd>C</kbd>: コミットを範囲コピー (cherry-pick) + <kbd>C</kbd>: コミットをコピー (cherry-pick) <kbd><c-r></kbd>: Reset cherry-picked (copied) commits selection <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: コミットを閲覧 diff --git a/docs/keybindings/Keybindings_ko.md b/docs/keybindings/Keybindings_ko.md index 7d60e1b07..df5024617 100644 --- a/docs/keybindings/Keybindings_ko.md +++ b/docs/keybindings/Keybindings_ko.md @@ -57,8 +57,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: 브라우저에서 커밋 열기 <kbd>n</kbd>: 커밋에서 새 브랜치를 만듭니다. <kbd>g</kbd>: View reset options - <kbd>c</kbd>: 커밋을 복사 (cherry-pick) - <kbd>C</kbd>: 커밋을 범위로 복사 (cherry-pick) + <kbd>C</kbd>: 커밋을 복사 (cherry-pick) <kbd><c-r></kbd>: Reset cherry-picked (copied) commits selection <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: 커밋 보기 @@ -88,8 +87,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: 브라우저에서 커밋 열기 <kbd>n</kbd>: 커밋에서 새 브랜치를 만듭니다. <kbd>g</kbd>: View reset options - <kbd>c</kbd>: 커밋을 복사 (cherry-pick) - <kbd>C</kbd>: 커밋을 범위로 복사 (cherry-pick) + <kbd>C</kbd>: 커밋을 복사 (cherry-pick) <kbd><c-r></kbd>: Reset cherry-picked (copied) commits selection <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: View selected item's files @@ -270,7 +268,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>S</kbd>: Squash all 'fixup!' commits above selected commit (autosquash) <kbd><c-j></kbd>: 커밋을 1개 아래로 이동 <kbd><c-k></kbd>: 커밋을 1개 위로 이동 - <kbd>v</kbd>: 커밋을 붙여넣기 (cherry-pick) + <kbd>V</kbd>: 커밋을 붙여넣기 (cherry-pick) <kbd>B</kbd>: Mark commit as base commit for rebase <kbd>A</kbd>: Amend commit with staged changes <kbd>a</kbd>: Set/Reset commit author @@ -283,8 +281,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: 브라우저에서 커밋 열기 <kbd>n</kbd>: 커밋에서 새 브랜치를 만듭니다. <kbd>g</kbd>: View reset options - <kbd>c</kbd>: 커밋을 복사 (cherry-pick) - <kbd>C</kbd>: 커밋을 범위로 복사 (cherry-pick) + <kbd>C</kbd>: 커밋을 복사 (cherry-pick) <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: View selected item's files <kbd>/</kbd>: 검색 시작 diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md index 1a1d432d5..1ffd1ddcc 100644 --- a/docs/keybindings/Keybindings_nl.md +++ b/docs/keybindings/Keybindings_nl.md @@ -151,7 +151,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>S</kbd>: Squash bovenstaande commits <kbd><c-j></kbd>: Verplaats commit 1 naar beneden <kbd><c-k></kbd>: Verplaats commit 1 naar boven - <kbd>v</kbd>: Plak commits (cherry-pick) + <kbd>V</kbd>: Plak commits (cherry-pick) <kbd>B</kbd>: Mark commit as base commit for rebase <kbd>A</kbd>: Wijzig commit met staged veranderingen <kbd>a</kbd>: Set/Reset commit author @@ -164,8 +164,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: Open commit in browser <kbd>n</kbd>: Creëer nieuwe branch van commit <kbd>g</kbd>: Bekijk reset opties - <kbd>c</kbd>: Kopieer commit (cherry-pick) - <kbd>C</kbd>: Kopieer commit reeks (cherry-pick) + <kbd>C</kbd>: Kopieer commit (cherry-pick) <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: Bekijk gecommite bestanden <kbd>/</kbd>: Start met zoeken @@ -227,8 +226,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: Open commit in browser <kbd>n</kbd>: Creëer nieuwe branch van commit <kbd>g</kbd>: Bekijk reset opties - <kbd>c</kbd>: Kopieer commit (cherry-pick) - <kbd>C</kbd>: Kopieer commit reeks (cherry-pick) + <kbd>C</kbd>: Kopieer commit (cherry-pick) <kbd><c-r></kbd>: Reset cherry-picked (gekopieerde) commits selectie <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: Bekijk commits @@ -316,8 +314,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: Open commit in browser <kbd>n</kbd>: Creëer nieuwe branch van commit <kbd>g</kbd>: Bekijk reset opties - <kbd>c</kbd>: Kopieer commit (cherry-pick) - <kbd>C</kbd>: Kopieer commit reeks (cherry-pick) + <kbd>C</kbd>: Kopieer commit (cherry-pick) <kbd><c-r></kbd>: Reset cherry-picked (gekopieerde) commits selectie <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: Bekijk gecommite bestanden diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md index 3290d6e38..8b1061824 100644 --- a/docs/keybindings/Keybindings_pl.md +++ b/docs/keybindings/Keybindings_pl.md @@ -72,7 +72,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>S</kbd>: Spłaszcz wszystkie commity naprawcze powyżej zaznaczonych commitów (autosquash) <kbd><c-j></kbd>: Przenieś commit 1 w dół <kbd><c-k></kbd>: Przenieś commit 1 w górę - <kbd>v</kbd>: Wklej commity (przebieranie) + <kbd>V</kbd>: Wklej commity (przebieranie) <kbd>B</kbd>: Mark commit as base commit for rebase <kbd>A</kbd>: Popraw commit zmianami z poczekalni <kbd>a</kbd>: Set/Reset commit author @@ -85,8 +85,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: Open commit in browser <kbd>n</kbd>: Create new branch off of commit <kbd>g</kbd>: Wyświetl opcje resetu - <kbd>c</kbd>: Kopiuj commit (przebieranie) - <kbd>C</kbd>: Kopiuj zakres commitów (przebieranie) + <kbd>C</kbd>: Kopiuj commit (przebieranie) <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: Przeglądaj pliki commita <kbd>/</kbd>: Search the current view by text @@ -225,8 +224,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: Open commit in browser <kbd>n</kbd>: Create new branch off of commit <kbd>g</kbd>: Wyświetl opcje resetu - <kbd>c</kbd>: Kopiuj commit (przebieranie) - <kbd>C</kbd>: Kopiuj zakres commitów (przebieranie) + <kbd>C</kbd>: Kopiuj commit (przebieranie) <kbd><c-r></kbd>: Reset cherry-picked (copied) commits selection <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: View commits @@ -309,8 +307,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: Open commit in browser <kbd>n</kbd>: Create new branch off of commit <kbd>g</kbd>: Wyświetl opcje resetu - <kbd>c</kbd>: Kopiuj commit (przebieranie) - <kbd>C</kbd>: Kopiuj zakres commitów (przebieranie) + <kbd>C</kbd>: Kopiuj commit (przebieranie) <kbd><c-r></kbd>: Reset cherry-picked (copied) commits selection <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: Przeglądaj pliki commita diff --git a/docs/keybindings/Keybindings_ru.md b/docs/keybindings/Keybindings_ru.md index 76cec5c5f..b2904d335 100644 --- a/docs/keybindings/Keybindings_ru.md +++ b/docs/keybindings/Keybindings_ru.md @@ -127,8 +127,7 @@ _Связки клавиш_ <kbd>o</kbd>: Открыть коммит в браузере <kbd>n</kbd>: Создать новую ветку с этого коммита <kbd>g</kbd>: Просмотреть параметры сброса - <kbd>c</kbd>: Скопировать отобранные коммит (cherry-pick) - <kbd>C</kbd>: Скопировать несколько отобранных коммитов (cherry-pick) + <kbd>C</kbd>: Скопировать отобранные коммит (cherry-pick) <kbd><c-r></kbd>: Сбросить отобранную (скопированную | cherry-picked) выборку коммитов <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: Просмотреть коммиты @@ -153,7 +152,7 @@ _Связки клавиш_ <kbd>S</kbd>: Объединить все 'fixup!' коммиты выше в выбранный коммит (автосохранение) <kbd><c-j></kbd>: Переместить коммит вниз на один <kbd><c-k></kbd>: Переместить коммит вверх на один - <kbd>v</kbd>: Вставить отобранные коммиты (cherry-pick) + <kbd>V</kbd>: Вставить отобранные коммиты (cherry-pick) <kbd>B</kbd>: Mark commit as base commit for rebase <kbd>A</kbd>: Править последний коммит с проиндексированными изменениями <kbd>a</kbd>: Установить/убрать автора коммита @@ -166,8 +165,7 @@ _Связки клавиш_ <kbd>o</kbd>: Открыть коммит в браузере <kbd>n</kbd>: Создать новую ветку с этого коммита <kbd>g</kbd>: Просмотреть параметры сброса - <kbd>c</kbd>: Скопировать отобранные коммит (cherry-pick) - <kbd>C</kbd>: Скопировать несколько отобранных коммитов (cherry-pick) + <kbd>C</kbd>: Скопировать отобранные коммит (cherry-pick) <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: Просмотреть файлы выбранного элемента <kbd>/</kbd>: Найти @@ -224,8 +222,7 @@ _Связки клавиш_ <kbd>o</kbd>: Открыть коммит в браузере <kbd>n</kbd>: Создать новую ветку с этого коммита <kbd>g</kbd>: Просмотреть параметры сброса - <kbd>c</kbd>: Скопировать отобранные коммит (cherry-pick) - <kbd>C</kbd>: Скопировать несколько отобранных коммитов (cherry-pick) + <kbd>C</kbd>: Скопировать отобранные коммит (cherry-pick) <kbd><c-r></kbd>: Сбросить отобранную (скопированную | cherry-picked) выборку коммитов <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: Просмотреть файлы выбранного элемента diff --git a/docs/keybindings/Keybindings_zh-CN.md b/docs/keybindings/Keybindings_zh-CN.md index 333cfada5..1496f8624 100644 --- a/docs/keybindings/Keybindings_zh-CN.md +++ b/docs/keybindings/Keybindings_zh-CN.md @@ -57,8 +57,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: 在浏览器中打开提交 <kbd>n</kbd>: 从提交创建新分支 <kbd>g</kbd>: 查看重置选项 - <kbd>c</kbd>: 复制提交(拣选) - <kbd>C</kbd>: 复制提交范围(拣选) + <kbd>C</kbd>: 复制提交(拣选) <kbd><c-r></kbd>: 重置已拣选(复制)的提交 <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: 查看提交 @@ -112,8 +111,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: 在浏览器中打开提交 <kbd>n</kbd>: 从提交创建新分支 <kbd>g</kbd>: 查看重置选项 - <kbd>c</kbd>: 复制提交(拣选) - <kbd>C</kbd>: 复制提交范围(拣选) + <kbd>C</kbd>: 复制提交(拣选) <kbd><c-r></kbd>: 重置已拣选(复制)的提交 <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: 查看提交的文件 @@ -153,7 +151,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>S</kbd>: 压缩在所选提交之上的所有“fixup!”提交(自动压缩) <kbd><c-j></kbd>: 下移提交 <kbd><c-k></kbd>: 上移提交 - <kbd>v</kbd>: 粘贴提交(拣选) + <kbd>V</kbd>: 粘贴提交(拣选) <kbd>B</kbd>: Mark commit as base commit for rebase <kbd>A</kbd>: 用已暂存的更改来修补提交 <kbd>a</kbd>: Set/Reset commit author @@ -166,8 +164,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_ <kbd>o</kbd>: 在浏览器中打开提交 <kbd>n</kbd>: 从提交创建新分支 <kbd>g</kbd>: 查看重置选项 - <kbd>c</kbd>: 复制提交(拣选) - <kbd>C</kbd>: 复制提交范围(拣选) + <kbd>C</kbd>: 复制提交(拣选) <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: 查看提交的文件 <kbd>/</kbd>: 开始搜索 diff --git a/docs/keybindings/Keybindings_zh-TW.md b/docs/keybindings/Keybindings_zh-TW.md index 81a2c4248..6243eafd4 100644 --- a/docs/keybindings/Keybindings_zh-TW.md +++ b/docs/keybindings/Keybindings_zh-TW.md @@ -57,8 +57,7 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B_ <kbd>o</kbd>: 在瀏覽器中開啟提交 <kbd>n</kbd>: 從提交建立新分支 <kbd>g</kbd>: 檢視重設選項 - <kbd>c</kbd>: 複製提交 (揀選) - <kbd>C</kbd>: 複製提交範圍 (揀選) + <kbd>C</kbd>: 複製提交 (揀選) <kbd><c-r></kbd>: 重設選定的揀選 (複製) 提交 <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: 檢視提交 @@ -153,8 +152,7 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B_ <kbd>o</kbd>: 在瀏覽器中開啟提交 <kbd>n</kbd>: 從提交建立新分支 <kbd>g</kbd>: 檢視重設選項 - <kbd>c</kbd>: 複製提交 (揀選) - <kbd>C</kbd>: 複製提交範圍 (揀選) + <kbd>C</kbd>: 複製提交 (揀選) <kbd><c-r></kbd>: 重設選定的揀選 (複製) 提交 <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: 檢視所選項目的檔案 @@ -194,7 +192,7 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B_ <kbd>S</kbd>: 壓縮上方所有的“fixup!”提交 (自動壓縮) <kbd><c-j></kbd>: 向下移動提交 <kbd><c-k></kbd>: 向上移動提交 - <kbd>v</kbd>: 貼上提交 (揀選) + <kbd>V</kbd>: 貼上提交 (揀選) <kbd>B</kbd>: Mark commit as base commit for rebase <kbd>A</kbd>: 使用已預存的更改修正提交 <kbd>a</kbd>: 設置/重設提交作者 @@ -207,8 +205,7 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B_ <kbd>o</kbd>: 在瀏覽器中開啟提交 <kbd>n</kbd>: 從提交建立新分支 <kbd>g</kbd>: 檢視重設選項 - <kbd>c</kbd>: 複製提交 (揀選) - <kbd>C</kbd>: 複製提交範圍 (揀選) + <kbd>C</kbd>: 複製提交 (揀選) <kbd><c-t></kbd>: Open external diff tool (git difftool) <kbd><enter></kbd>: 檢視所選項目的檔案 <kbd>/</kbd>: 開始搜尋 diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index a966905d0..e9f739a1d 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -418,7 +418,6 @@ type KeybindingCommitsConfig struct { PickCommit string `yaml:"pickCommit"` RevertCommit string `yaml:"revertCommit"` CherryPickCopy string `yaml:"cherryPickCopy"` - CherryPickCopyRange string `yaml:"cherryPickCopyRange"` PasteCommits string `yaml:"pasteCommits"` MarkCommitAsBaseForRebase string `yaml:"markCommitAsBaseForRebase"` CreateTag string `yaml:"tagCommit"` @@ -812,9 +811,8 @@ func GetDefaultConfig() *UserConfig { ResetCommitAuthor: "a", PickCommit: "p", RevertCommit: "t", - CherryPickCopy: "c", - CherryPickCopyRange: "C", - PasteCommits: "v", + CherryPickCopy: "C", + PasteCommits: "V", MarkCommitAsBaseForRebase: "B", CreateTag: "T", CheckoutCommit: "<space>", diff --git a/pkg/gui/controllers/basic_commits_controller.go b/pkg/gui/controllers/basic_commits_controller.go index 551349466..2f120a0f4 100644 --- a/pkg/gui/controllers/basic_commits_controller.go +++ b/pkg/gui/controllers/basic_commits_controller.go @@ -14,6 +14,7 @@ var _ types.IController = &BasicCommitsController{} type ContainsCommits interface { types.Context + types.IListContext GetSelected() *models.Commit GetCommits() []*models.Commit GetSelectedLineIdx() int @@ -64,13 +65,8 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [ }, { Key: opts.GetKey(opts.Config.Commits.CherryPickCopy), - Handler: self.checkSelected(self.copy), - Description: self.c.Tr.CherryPickCopy, - }, - { - Key: opts.GetKey(opts.Config.Commits.CherryPickCopyRange), Handler: self.checkSelected(self.copyRange), - Description: self.c.Tr.CherryPickCopyRange, + Description: self.c.Tr.CherryPickCopy, }, { Key: opts.GetKey(opts.Config.Commits.ResetCherryPick), @@ -271,12 +267,8 @@ func (self *BasicCommitsController) checkout(commit *models.Commit) error { }) } -func (self *BasicCommitsController) copy(commit *models.Commit) error { - return self.c.Helpers().CherryPick.Copy(commit, self.context.GetCommits(), self.context) -} - func (self *BasicCommitsController) copyRange(*models.Commit) error { - return self.c.Helpers().CherryPick.CopyRange(self.context.GetSelectedLineIdx(), self.context.GetCommits(), self.context) + return self.c.Helpers().CherryPick.CopyRange(self.context.GetCommits(), self.context) } func (self *BasicCommitsController) openDiffTool(commit *models.Commit) error { diff --git a/pkg/gui/controllers/helpers/cherry_pick_helper.go b/pkg/gui/controllers/helpers/cherry_pick_helper.go index 4f455ca30..61a37220b 100644 --- a/pkg/gui/controllers/helpers/cherry_pick_helper.go +++ b/pkg/gui/controllers/helpers/cherry_pick_helper.go @@ -5,6 +5,7 @@ import ( "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/modes/cherrypicking" "github.com/jesseduffield/lazygit/pkg/gui/types" + "github.com/samber/lo" ) type CherryPickHelper struct { @@ -45,25 +46,30 @@ func (self *CherryPickHelper) Copy(commit *models.Commit, commitsList []*models. return self.rerender() } -func (self *CherryPickHelper) CopyRange(selectedIndex int, commitsList []*models.Commit, context types.Context) error { +func (self *CherryPickHelper) CopyRange(commitsList []*models.Commit, context types.IListContext) error { + startIdx, endIdx := context.GetList().GetSelectionRange() + if err := self.resetIfNecessary(context); err != nil { return err } commitSet := self.getData().SelectedShaSet() - // find the last commit that is copied that's above our position - // if there are none, startIndex = 0 - startIndex := 0 - for index, commit := range commitsList[0:selectedIndex] { - if commitSet.Includes(commit.Sha) { - startIndex = index - } |