Skip to content

Commit

Permalink
Fix the title and text (and variable names) of the Discard Changes pr…
Browse files Browse the repository at this point in the history
…ompt

The title was saying "Unstage lines", which was just wrong. The text said
"Delete lines", which can be seen as a bit misleading; we are only discarding
the changes to the selected lines, not deleting the lines themselves.

For consistency, rename the config variable skipUnstageLineWarning accordingly.
  • Loading branch information
stefanhaller committed Jun 26, 2023
1 parent 6ecd691 commit 51a5580
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ gui:
commitLength:
show: true
mouseEvents: true
skipUnstageLineWarning: false
skipDiscardChangeWarning: false
skipStashWarning: false
showFileTree: true # for rendering changes files in a tree format
showListFooter: true # for seeing the '5 of 20' message in list panels
Expand Down
24 changes: 12 additions & 12 deletions pkg/config/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type GuiConfig struct {
ScrollHeight int `yaml:"scrollHeight"`
ScrollPastBottom bool `yaml:"scrollPastBottom"`
MouseEvents bool `yaml:"mouseEvents"`
SkipUnstageLineWarning bool `yaml:"skipUnstageLineWarning"`
SkipDiscardChangeWarning bool `yaml:"skipDiscardChangeWarning"`
SkipStashWarning bool `yaml:"skipStashWarning"`
SidePanelWidth float64 `yaml:"sidePanelWidth"`
ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"`
Expand Down Expand Up @@ -397,17 +397,17 @@ type CustomCommandMenuOption struct {
func GetDefaultConfig() *UserConfig {
return &UserConfig{
Gui: GuiConfig{
ScrollHeight: 2,
ScrollPastBottom: true,
MouseEvents: true,
SkipUnstageLineWarning: false,
SkipStashWarning: false,
SidePanelWidth: 0.3333,
ExpandFocusedSidePanel: false,
MainPanelSplitMode: "flexible",
Language: "auto",
TimeFormat: "02 Jan 06",
ShortTimeFormat: time.Kitchen,
ScrollHeight: 2,
ScrollPastBottom: true,
MouseEvents: true,
SkipDiscardChangeWarning: false,
SkipStashWarning: false,
SidePanelWidth: 0.3333,
ExpandFocusedSidePanel: false,
MainPanelSplitMode: "flexible",
Language: "auto",
TimeFormat: "02 Jan 06",
ShortTimeFormat: time.Kitchen,
Theme: ThemeConfig{
ActiveBorderColor: []string{"green", "bold"},
InactiveBorderColor: []string{"default"},
Expand Down
6 changes: 3 additions & 3 deletions pkg/gui/controllers/staging_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ func (self *StagingController) ToggleStaged() error {
func (self *StagingController) ResetSelection() error {
reset := func() error { return self.applySelectionAndRefresh(true) }

if !self.staged && !self.c.UserConfig.Gui.SkipUnstageLineWarning {
if !self.staged && !self.c.UserConfig.Gui.SkipDiscardChangeWarning {
return self.c.Confirm(types.ConfirmOpts{
Title: self.c.Tr.UnstageLinesTitle,
Prompt: self.c.Tr.UnstageLinesPrompt,
Title: self.c.Tr.DiscardChangeTitle,
Prompt: self.c.Tr.DiscardChangePrompt,
HandleConfirm: reset,
})
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/i18n/chinese.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ func chineseTranslationSet() TranslationSet {
NoFilesStagedPrompt: "您尚未暂存任何文件。提交所有文件?",
BranchNotFoundTitle: "找不到分支",
BranchNotFoundPrompt: "找不到分支。创建一个新分支命名为:",
UnstageLinesTitle: "取消暂存选中的行",
UnstageLinesPrompt: "您确定要删除所选的行(git reset)吗?这是不可逆的。\n要禁用此对话框,请将 'gui.skipUnstageLineWarning' 的配置键设置为 true",
DiscardChangeTitle: "取消暂存选中的行",
DiscardChangePrompt: "您确定要删除所选的行(git reset)吗?这是不可逆的。\n要禁用此对话框,请将 'gui.skipDiscardChangeWarning' 的配置键设置为 true",
CreateNewBranchFromCommit: "从提交创建新分支",
BuildingPatch: "正在构建补丁",
ViewCommits: "查看提交",
Expand Down
8 changes: 4 additions & 4 deletions pkg/i18n/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ type TranslationSet struct {
BranchNotFoundTitle string
BranchNotFoundPrompt string
BranchUnknown string
UnstageLinesTitle string
UnstageLinesPrompt string
DiscardChangeTitle string
DiscardChangePrompt string
CreateNewBranchFromCommit string
BuildingPatch string
ViewCommits string
Expand Down Expand Up @@ -1119,8 +1119,8 @@ func EnglishTranslationSet() TranslationSet {
BranchNotFoundTitle: "Branch not found",
BranchNotFoundPrompt: "Branch not found. Create a new branch named",
BranchUnknown: "Branch unknown",
UnstageLinesTitle: "Unstage lines",
UnstageLinesPrompt: "Are you sure you want to delete the selected lines (git reset)? It is irreversible.\nTo disable this dialogue set the config key of 'gui.skipUnstageLineWarning' to true",
DiscardChangeTitle: "Discard change",
DiscardChangePrompt: "Are you sure you want to discard this change (git reset)? It is irreversible.\nTo disable this dialogue set the config key of 'gui.skipDiscardChangeWarning' to true",
CreateNewBranchFromCommit: "Create new branch off of commit",
BuildingPatch: "Building patch",
ViewCommits: "View commits",
Expand Down
4 changes: 2 additions & 2 deletions pkg/i18n/japanese.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ func japaneseTranslationSet() TranslationSet {
NoFilesStagedPrompt: "ファイルがステージされていません。すべての変更をコミットしますか?",
BranchNotFoundTitle: "ブランチが見つかりませんでした。",
BranchNotFoundPrompt: "ブランチが見つかりませんでした。新しくブランチを作成します ",
UnstageLinesTitle: "選択行をアンステージ",
UnstageLinesPrompt: "選択された行を削除 (git reset) します。よろしいですか? この操作は取り消せません。\nこの警告を無効化するには設定ファイルの 'gui.skipUnstageLineWarning' を true に設定してください。",
DiscardChangeTitle: "選択行をアンステージ",
DiscardChangePrompt: "選択された行を削除 (git reset) します。よろしいですか? この操作は取り消せません。\nこの警告を無効化するには設定ファイルの 'gui.skipDiscardChangeWarning' を true に設定してください。",
CreateNewBranchFromCommit: "コミットにブランチを作成",
BuildingPatch: "パッチを構築",
ViewCommits: "コミットを閲覧",
Expand Down
4 changes: 2 additions & 2 deletions pkg/i18n/korean.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ func koreanTranslationSet() TranslationSet {
NoFilesStagedPrompt: "파일이 Staged 되지 않았습니다. 모든 파일을 커밋하시겠습니까?",
BranchNotFoundTitle: "브랜치를 찾을 수 없습니다.",
BranchNotFoundPrompt: "브랜치를 찾을 수 없습니다. 새로운 브랜치를 생성합니다.",
UnstageLinesTitle: "선택한 라인을 unstaged",
UnstageLinesPrompt: "정말로 선택한 라인을 삭제 (git reset) 하시겠습니까? 이 조작은 취소할 수 없습니다.\n이 경고를 비활성화 하려면 설정 파일의 'gui.skipUnstageLineWarning' 를 true로 설정하세요.",
DiscardChangeTitle: "선택한 라인을 unstaged",
DiscardChangePrompt: "정말로 선택한 라인을 삭제 (git reset) 하시겠습니까? 이 조작은 취소할 수 없습니다.\n이 경고를 비활성화 하려면 설정 파일의 'gui.skipDiscardChangeWarning' 를 true로 설정하세요.",
CreateNewBranchFromCommit: "커밋에서 새 브랜치를 만듭니다.",
BuildingPatch: "Building patch",
ViewCommits: "커밋 보기",
Expand Down
4 changes: 2 additions & 2 deletions pkg/i18n/traditional_chinese.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ func traditionalChineseTranslationSet() TranslationSet {
BranchNotFoundTitle: "找不到分支",
BranchNotFoundPrompt: "找不到分支。是否創建一個名為",
BranchUnknown: "分支未知",
UnstageLinesTitle: "取消預存行",
UnstageLinesPrompt: "你確定要刪除所選行嗎(git reset)?此操作是不可逆的。\n要禁用此對話框,請將“gui.skipUnstageLineWarning”設置為true。",
DiscardChangeTitle: "取消預存行",
DiscardChangePrompt: "你確定要刪除所選行嗎(git reset)?此操作是不可逆的。\n要禁用此對話框,請將“gui.skipDiscardChangeWarning”設置為true。",
CreateNewBranchFromCommit: "從提交建立新分支",
BuildingPatch: "正在建立補丁",
ViewCommits: "檢視提交",
Expand Down
4 changes: 2 additions & 2 deletions pkg/integration/components/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func (self *Common) ContinueOnConflictsResolved() {

func (self *Common) ConfirmDiscardLines() {
self.t.ExpectPopup().Confirmation().
Title(Equals("Unstage lines")).
Content(Contains("Are you sure you want to delete the selected lines")).
Title(Equals("Discard change")).
Content(Contains("Are you sure you want to discard this change")).
Confirm()
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/integration/tests/staging/stage_lines.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ var StageLines = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Unstage lines")).
Content(Contains("Are you sure you want to delete the selected lines")).
Title(Equals("Discard change")).
Content(Contains("Are you sure you want to discard this change")).
Confirm()
}).
IsEmpty()
Expand Down

0 comments on commit 51a5580

Please sign in to comment.