diff options
author | Alex Goodman <wagoodman@gmail.com> | 2019-07-21 15:02:09 -0400 |
---|---|---|
committer | Alex Goodman <wagoodman@gmail.com> | 2019-07-21 15:02:09 -0400 |
commit | 174dc6de1a54f34c1c56b0096c50ad8b1a0a8c55 (patch) | |
tree | dd17bd462cb789348eab7787d79d39d1b97cf6b3 /ui | |
parent | 48df08f11756045d9dc7dd964b786a5b19843996 (diff) |
keep modified/unmodified nomenclature the same
Diffstat (limited to 'ui')
-rw-r--r-- | ui/filetree_controller.go | 20 | ||||
-rw-r--r-- | ui/filetree_viewmodel.go | 8 | ||||
-rw-r--r-- | ui/filetree_viewmodel_test.go | 4 |
3 files changed, 18 insertions, 14 deletions
diff --git a/ui/filetree_controller.go b/ui/filetree_controller.go index 9ca083f..7a8c375 100644 --- a/ui/filetree_controller.go +++ b/ui/filetree_controller.go @@ -35,7 +35,7 @@ type FileTreeController struct { keybindingToggleAdded []keybinding.Key keybindingToggleRemoved []keybinding.Key keybindingToggleModified []keybinding.Key - keybindingToggleUnchanged []keybinding.Key + keybindingToggleUnmodified []keybinding.Key keybindingPageDown []keybinding.Key keybindingPageUp []keybinding.Key } @@ -80,9 +80,13 @@ func NewFileTreeController(name string, gui *gocui.Gui, tree *filetree.FileTree, logrus.Error(err) } - controller.keybindingToggleUnchanged, err = keybinding.ParseAll(viper.GetString("keybinding.toggle-unchanged-files")) + // support legacy behavior first, then use default behavior + controller.keybindingToggleUnmodified, err = keybinding.ParseAll(viper.GetString("keybinding.toggle-unchanged-files")) if err != nil { - logrus.Error(err) + controller.keybindingToggleUnmodified, err = keybinding.ParseAll(viper.GetString("keybinding.toggle-unmodified-files")) + if err != nil { + logrus.Error(err) + } } controller.keybindingPageUp, err = keybinding.ParseAll(viper.GetString("keybinding.page-up")) @@ -162,12 +166,12 @@ func (controller *FileTreeController) Setup(v *gocui.View, header *gocui.View) e } } for _, key := range controller.keybindingToggleModified { - if err := controller.gui.SetKeybinding(controller.Name, key.Value, key.Modifier, func(*gocui.Gui, *gocui.View) error { return controller.toggleShowDiffType(filetree.Changed) }); err != nil { + if err := controller.gui.SetKeybinding(controller.Name, key.Value, key.Modifier, func(*gocui.Gui, *gocui.View) error { return controller.toggleShowDiffType(filetree.Modified) }); err != nil { return err } } - for _, key := range controller.keybindingToggleUnchanged { - if err := controller.gui.SetKeybinding(controller.Name, key.Value, key.Modifier, func(*gocui.Gui, *gocui.View) error { return controller.toggleShowDiffType(filetree.Unchanged) }); err != nil { + for _, key := range controller.keybindingToggleUnmodified { + if err := controller.gui.SetKeybinding(controller.Name, key.Value, key.Modifier, func(*gocui.Gui, *gocui.View) error { return controller.toggleShowDiffType(filetree.Unmodified) }); err != nil { return err } } @@ -392,7 +396,7 @@ func (controller *FileTreeController) KeyHelp() string { renderStatusOption(controller.keybindingToggleCollapseAll[0].String(), "Collapse all dir", false) + renderStatusOption(controller.keybindingToggleAdded[0].String(), "Added", !controller.vm.HiddenDiffTypes[filetree.Added]) + renderStatusOption(controller.keybindingToggleRemoved[0].String(), "Removed", !controller.vm.HiddenDiffTypes[filetree.Removed]) + - renderStatusOption(controller.keybindingToggleModified[0].String(), "Modified", !controller.vm.HiddenDiffTypes[filetree.Changed]) + - renderStatusOption(controller.keybindingToggleUnchanged[0].String(), "Unmodified", !controller.vm.HiddenDiffTypes[filetree.Unchanged]) + + renderStatusOption(controller.keybindingToggleModified[0].String(), "Modified", !controller.vm.HiddenDiffTypes[filetree.Modified]) + + renderStatusOption(controller.keybindingToggleUnmodified[0].String(), "Unmodified", !controller.vm.HiddenDiffTypes[filetree.Unmodified]) + renderStatusOption(controller.keybindingToggleAttributes[0].String(), "Attributes", controller.vm.ShowAttributes) } diff --git a/ui/filetree_viewmodel.go b/ui/filetree_viewmodel.go index 08b66a3..c253d0d 100644 --- a/ui/filetree_viewmodel.go +++ b/ui/filetree_viewmodel.go @@ -53,10 +53,10 @@ func NewFileTreeViewModel(tree *filetree.FileTree, refTrees []*filetree.FileTree treeViewModel.HiddenDiffTypes[filetree.Added] = true case "removed": treeViewModel.HiddenDiffTypes[filetree.Removed] = true - case "changed": - treeViewModel.HiddenDiffTypes[filetree.Changed] = true - case "unchanged": - treeViewModel.HiddenDiffTypes[filetree.Unchanged] = true + case "modified": + treeViewModel.HiddenDiffTypes[filetree.Modified] = true + case "unmodified": + treeViewModel.HiddenDiffTypes[filetree.Unmodified] = true default: utils.PrintAndExit(fmt.Sprintf("unknown diff.hide value: %s", t)) } diff --git a/ui/filetree_viewmodel_test.go b/ui/filetree_viewmodel_test.go index b42254a..8bea822 100644 --- a/ui/filetree_viewmodel_test.go +++ b/ui/filetree_viewmodel_test.go @@ -324,7 +324,7 @@ func TestFileTreeHideAddedRemovedModified(t *testing.T) { vm.toggleShowDiffType(filetree.Added) // hide modified files - vm.toggleShowDiffType(filetree.Changed) + vm.toggleShowDiffType(filetree.Modified) // hide removed files vm.toggleShowDiffType(filetree.Removed) @@ -350,7 +350,7 @@ func TestFileTreeHideUnmodified(t *testing.T) { } // hide unmodified files - vm.toggleShowDiffType(filetree.Unchanged) + vm.toggleShowDiffType(filetree.Unmodified) runTestCase(t, vm, width, height, nil) } |