1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-28 09:08:41 +02:00

Merge pull request #2293 from jesseduffield/feature/make-discarding-harder

This commit is contained in:
Jesse Duffield 2023-02-21 22:03:25 +11:00 committed by GitHub
commit 526c9dea9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 80 additions and 71 deletions

View File

@ -136,7 +136,7 @@ keybinding:
jumpToBlock: ['1', '2', '3', '4', '5'] # goto the Nth block / panel
nextMatch: 'n'
prevMatch: 'N'
optionMenu: 'x' # show help menu
optionMenu: null # show help menu
optionMenu-alt1: '?' # show help menu
select: '<space>'
goInto: '<enter>'

View File

@ -11,7 +11,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>m</kbd>: view merge/rebase options
<kbd>ctrl+p</kbd>: view custom patch options
<kbd>R</kbd>: refresh
<kbd>x</kbd>: open menu
<kbd>?</kbd>: open menu
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
<kbd>_</kbd>: prev screen mode
<kbd>ctrl+s</kbd>: view filter-by-path options

View File

@ -11,7 +11,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>m</kbd>: view merge/rebase options
<kbd>ctrl+p</kbd>: view custom patch options
<kbd>R</kbd>: リフレッシュ
<kbd>x</kbd>: メニューを開く
<kbd>?</kbd>: メニューを開く
<kbd>+</kbd>: 次のスクリーンモード (normal/half/fullscreen)
<kbd>_</kbd>: 前のスクリーンモード
<kbd>ctrl+s</kbd>: view filter-by-path options

View File

@ -11,7 +11,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>m</kbd>: view merge/rebase options
<kbd>ctrl+p</kbd>: 커스텀 Patch 옵션 보기
<kbd>R</kbd>: 새로고침
<kbd>x</kbd>: 매뉴 열기
<kbd>?</kbd>: 매뉴 열기
<kbd>+</kbd>: 다음 스크린 모드 (normal/half/fullscreen)
<kbd>_</kbd>: 이전 스크린 모드
<kbd>ctrl+s</kbd>: view filter-by-path options

View File

@ -11,7 +11,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>m</kbd>: bekijk merge/rebase opties
<kbd>ctrl+p</kbd>: bekijk aangepaste patch opties
<kbd>R</kbd>: verversen
<kbd>x</kbd>: open menu
<kbd>?</kbd>: open menu
<kbd>+</kbd>: volgende scherm modus (normaal/half/groot)
<kbd>_</kbd>: vorige scherm modus
<kbd>ctrl+s</kbd>: bekijk scoping opties

View File

@ -11,7 +11,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>m</kbd>: widok scalenia/opcje zmiany bazy
<kbd>ctrl+p</kbd>: view custom patch options
<kbd>R</kbd>: odśwież
<kbd>x</kbd>: open menu
<kbd>?</kbd>: open menu
<kbd>+</kbd>: next screen mode (normal/half/fullscreen)
<kbd>_</kbd>: prev screen mode
<kbd>ctrl+s</kbd>: view filter-by-path options

View File

@ -11,7 +11,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
<kbd>m</kbd>: 查看 合并/变基 选项
<kbd>ctrl+p</kbd>: 查看自定义补丁选项
<kbd>R</kbd>: 刷新
<kbd>x</kbd>: 打开菜单
<kbd>?</kbd>: 打开菜单
<kbd>+</kbd>: 下一屏模式(正常/半屏/全屏)
<kbd>_</kbd>: 上一屏模式
<kbd>ctrl+s</kbd>: 查看按路径过滤选项

View File

@ -450,7 +450,7 @@ func GetDefaultConfig() *UserConfig {
NextMatch: "n",
PrevMatch: "N",
StartSearch: "/",
OptionMenu: "x",
OptionMenu: "",
OptionMenuAlt1: "?",
Select: "<space>",
GoInto: "<enter>",

View File

@ -5,6 +5,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
)
// splitting this action out into its own file because it's self-contained
@ -51,7 +52,13 @@ func (self *FilesRemoveController) remove(node *filetree.FileNode) error {
}
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}})
},
Key: 'd',
Key: 'x',
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.DiscardAllTooltip,
map[string]string{
"path": node.GetPath(),
},
),
},
}
@ -67,6 +74,12 @@ func (self *FilesRemoveController) remove(node *filetree.FileNode) error {
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}})
},
Key: 'u',
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.DiscardUnstagedTooltip,
map[string]string{
"path": node.GetPath(),
},
),
})
}
} else {
@ -95,7 +108,13 @@ func (self *FilesRemoveController) remove(node *filetree.FileNode) error {
}
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}})
},
Key: 'd',
Key: 'x',
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.DiscardAllTooltip,
map[string]string{
"path": node.GetPath(),
},
),
},
}
@ -111,6 +130,12 @@ func (self *FilesRemoveController) remove(node *filetree.FileNode) error {
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}})
},
Key: 'u',
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.DiscardUnstagedTooltip,
map[string]string{
"path": node.GetPath(),
},
),
})
}
}

View File

@ -31,7 +31,7 @@ func (self *FilesController) createResetMenu() error {
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES}})
},
Key: 'D',
Key: 'x',
Tooltip: self.c.Tr.NukeDescription,
},
{

View File

@ -145,17 +145,19 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
Description: self.c.Tr.LcRefresh,
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.OptionMenu),
Handler: self.handleCreateOptionsMenu,
Description: self.c.Tr.LcOpenMenu,
OpensMenu: true,
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.OptionMenu),
Handler: self.handleCreateOptionsMenu,
OpensMenu: true,
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.OptionMenuAlt1),
Modifier: gocui.ModNone,
Handler: self.handleCreateOptionsMenu,
// we have the description on the alt key and not the main key for legacy reasons
// (the original main key was 'x' but we've reassigned that to other purposes)
Description: self.c.Tr.LcOpenMenu,
Handler: self.handleCreateOptionsMenu,
},
{
ViewName: "status",

View File

@ -107,9 +107,9 @@ func (gui *Gui) globalOptionsMap() map[string]string {
return map[string]string{
fmt.Sprintf("%s/%s", keybindings.Label(keybindingConfig.Universal.ScrollUpMain), keybindings.Label(keybindingConfig.Universal.ScrollDownMain)): gui.c.Tr.LcScroll,
fmt.Sprintf("%s %s %s %s", keybindings.Label(keybindingConfig.Universal.PrevBlock), keybindings.Label(keybindingConfig.Universal.NextBlock), keybindings.Label(keybindingConfig.Universal.PrevItem), keybindings.Label(keybindingConfig.Universal.NextItem)): gui.c.Tr.LcNavigate,
keybindings.Label(keybindingConfig.Universal.Return): gui.c.Tr.LcCancel,
keybindings.Label(keybindingConfig.Universal.Quit): gui.c.Tr.LcQuit,
keybindings.Label(keybindingConfig.Universal.OptionMenu): gui.c.Tr.LcMenu,
keybindings.Label(keybindingConfig.Universal.Return): gui.c.Tr.LcCancel,
keybindings.Label(keybindingConfig.Universal.Quit): gui.c.Tr.LcQuit,
keybindings.Label(keybindingConfig.Universal.OptionMenuAlt1): gui.c.Tr.LcMenu,
fmt.Sprintf("%s-%s", keybindings.Label(keybindingConfig.Universal.JumpToBlock[0]), keybindings.Label(keybindingConfig.Universal.JumpToBlock[len(keybindingConfig.Universal.JumpToBlock)-1])): gui.c.Tr.LcJump,
fmt.Sprintf("%s/%s", keybindings.Label(keybindingConfig.Universal.ScrollLeft), keybindings.Label(keybindingConfig.Universal.ScrollRight)): gui.c.Tr.LcScrollLeftRight,
}

View File

@ -115,6 +115,8 @@ type TranslationSet struct {
LcRedoReflog string
UndoTooltip string
RedoTooltip string
DiscardAllTooltip string
DiscardUnstagedTooltip string
LcPop string
LcDrop string
LcApply string
@ -762,6 +764,8 @@ func EnglishTranslationSet() TranslationSet {
LcRedoReflog: "redo (via reflog) (experimental)",
UndoTooltip: "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.",
RedoTooltip: "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.",
DiscardAllTooltip: "Discard both staged and unstaged changes in '{{.path}}'.",
DiscardUnstagedTooltip: "Discard unstaged changes in '{{.path}}'.",
LcPop: "pop",
LcDrop: "drop",
LcApply: "apply",

View File

@ -21,6 +21,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/integration/tests/submodule"
"github.com/jesseduffield/lazygit/pkg/integration/tests/sync"
"github.com/jesseduffield/lazygit/pkg/integration/tests/tag"
"github.com/jesseduffield/lazygit/pkg/integration/tests/ui"
"github.com/jesseduffield/lazygit/pkg/integration/tests/undo"
)
@ -115,6 +116,7 @@ var tests = []*components.IntegrationTest{
tag.CrudAnnotated,
tag.CrudLightweight,
tag.Reset,
ui.SwitchTabFromMenu,
undo.UndoCheckoutAndDrop,
undo.UndoDrop,
}

View File

@ -0,0 +1,27 @@
package ui
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var SwitchTabFromMenu = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Switch tab via the options menu",
ExtraCmdArgs: "",
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.UserConfig.Git.AutoFetch = false
},
SetupRepo: func(shell *Shell) {
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Files().IsFocused().
Press(keys.Universal.OptionMenuAlt1)
t.ExpectPopup().Menu().Title(Equals("Menu")).
Select(Contains("next tab")).
Confirm()
t.Views().Submodules().IsFocused()
},
})

View File

@ -1 +0,0 @@
72068e9a852a790a9b867e8b5d21cb4ede3ba4d7

View File

@ -1,8 +0,0 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[user]
email = CI@example.com
name = CI

View File

@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -1,6 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View File

@ -1,3 +0,0 @@
0000000000000000000000000000000000000000 e0aeb3ba0b32392aaf7d88a5190aca76be967225 CI <CI@example.com> 1623779969 +0200 commit (initial): file0
e0aeb3ba0b32392aaf7d88a5190aca76be967225 72068e9a852a790a9b867e8b5d21cb4ede3ba4d7 CI <CI@example.com> 1623779969 +0200 commit: file0
72068e9a852a790a9b867e8b5d21cb4ede3ba4d7 72068e9a852a790a9b867e8b5d21cb4ede3ba4d7 CI <CI@example.com> 1623779976 +0200 checkout: moving from master to 0.0.2

View File

@ -1,2 +0,0 @@
0000000000000000000000000000000000000000 e0aeb3ba0b32392aaf7d88a5190aca76be967225 CI <CI@example.com> 1623779969 +0200 commit (initial): file0
e0aeb3ba0b32392aaf7d88a5190aca76be967225 72068e9a852a790a9b867e8b5d21cb4ede3ba4d7 CI <CI@example.com> 1623779969 +0200 commit: file0

View File

@ -1,2 +0,0 @@
xЌЋK
В0@]зЩ ’L>“Ў«c’N°Р�R"x|{7oсx‹WzkлР–а2]|pѕ›ЅНXRЁѕтвcА”,t%µу!пЎЕ°d—ЩdЋЂ№в’K† cМB‚вПxхCOіѕOуSѕЬцMnҐ·‡¶"Q$}5`Њ:н95дП\ХuЈ~P49c

View File

@ -1,2 +0,0 @@
xЌНA
В0@QЧ9ЕмЙ$УLD„®zЊfњ`Ў!ҐDршцn?ѕ¶ZЧHtй‡xбДщi$ !b“HPEНCVJжв–O·¦оУьґпRчНnЪк0…И,’®>xпОzNєэЙ]Y7у+t

View File

@ -1 +0,0 @@
72068e9a852a790a9b867e8b5d21cb4ede3ba4d7

View File

@ -1 +0,0 @@
e0aeb3ba0b32392aaf7d88a5190aca76be967225

View File

@ -1 +0,0 @@
72068e9a852a790a9b867e8b5d21cb4ede3ba4d7

View File

@ -1 +0,0 @@
{"KeyEvents":[{"Timestamp":1446,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1701,"Mod":0,"Key":256,"Ch":120},{"Timestamp":2661,"Mod":0,"Key":256,"Ch":47},{"Timestamp":3149,"Mod":0,"Key":256,"Ch":112},{"Timestamp":3301,"Mod":0,"Key":256,"Ch":114},{"Timestamp":3349,"Mod":0,"Key":256,"Ch":101},{"Timestamp":3509,"Mod":0,"Key":256,"Ch":118},{"Timestamp":3573,"Mod":0,"Key":256,"Ch":105},{"Timestamp":3653,"Mod":0,"Key":256,"Ch":111},{"Timestamp":3757,"Mod":0,"Key":256,"Ch":117},{"Timestamp":3837,"Mod":0,"Key":256,"Ch":115},{"Timestamp":4013,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4157,"Mod":0,"Key":256,"Ch":116},{"Timestamp":4213,"Mod":0,"Key":256,"Ch":97},{"Timestamp":4268,"Mod":0,"Key":256,"Ch":98},{"Timestamp":4533,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5140,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5860,"Mod":0,"Key":258,"Ch":0},{"Timestamp":6157,"Mod":0,"Key":256,"Ch":32},{"Timestamp":6701,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":79}]}

View File

@ -1,20 +0,0 @@
#!/bin/sh
set -e
cd $1
git init
git config user.email "CI@example.com"
git config user.name "CI"
touch file0
git add file0
git commit -am file0
git tag 0.0.1
touch file1
git add file1
git commit -am file0
git tag 0.0.2

View File

@ -1 +0,0 @@
{ "description": "Change tabs from Options menu", "speed": 1 }