summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2024-01-02 14:00:36 +1100
committerJesse Duffield <jessedduffield@gmail.com>2024-01-28 08:12:01 +1100
commit7bddf532235cc67d847fd70d8f709b6401737936 (patch)
treec248ea926268ecd1e844d924fac438c6f1701edd /pkg/gui/controllers.go
parent0aa6109d4d767cf77d4fb3eeefd0ac477d718ccf (diff)
Improve keybinding descriptions
This adds a bunch of tooltips to keybindings and updates some keybinding descriptions (i.e. labels). It's in preparation for displaying more keybindings on-screen (in the bottom right of the screen), and so due in part to laziness it shortens some descriptions so that we don't need to manage both a short and long description (for on-screen vs in-menu). Nonetheless I've added a ShortDescription field for when we do want to have both a short and long description. You'll notice that some keybindings I deemed unworthy of the options view have longer descriptions, because I could get away with it.
Diffstat (limited to 'pkg/gui/controllers.go')
-rw-r--r--pkg/gui/controllers.go34
1 files changed, 16 insertions, 18 deletions
diff --git a/pkg/gui/controllers.go b/pkg/gui/controllers.go
index 5837704b5..30caae930 100644
--- a/pkg/gui/controllers.go
+++ b/pkg/gui/controllers.go
@@ -16,6 +16,9 @@ func (gui *Gui) Helpers() *helpers.Helpers {
return gui.helpers
}
+// Note, the order of controllers determines the order in which keybindings appear
+// in the keybinding menu: the earlier that the controller is attached to a context,
+// the lower in the list the keybindings will appear.
func (gui *Gui) resetHelpersAndControllers() {
helperCommon := gui.c
recordDirectoryHelper := helpers.NewRecordDirectoryHelper(helperCommon)
@@ -199,6 +202,18 @@ func (gui *Gui) resetHelpersAndControllers() {
controllers.AttachControllers(context, searchControllerFactory.Create(context))
}
+ for _, context := range []controllers.CanViewWorktreeOptions{
+ gui.State.Contexts.LocalCommits,
+ gui.State.Contexts.ReflogCommits,
+ gui.State.Contexts.SubCommits,
+ gui.State.Contexts.Stash,
+ gui.State.Contexts.Branches,
+ gui.State.Contexts.RemoteBranches,
+ gui.State.Contexts.Tags,
+ } {
+ controllers.AttachControllers(context, controllers.NewWorktreeOptionsController(common, context))
+ }
+
// allow for navigating between side window contexts
for _, context := range []types.Context{
gui.State.Contexts.Status,
@@ -247,18 +262,6 @@ func (gui *Gui) resetHelpersAndControllers() {
controllers.AttachControllers(context, controllers.NewBasicCommitsController(common, context))
}
- for _, context := range []controllers.CanViewWorktreeOptions{
- gui.State.Contexts.LocalCommits,
- gui.State.Contexts.ReflogCommits,
- gui.State.Contexts.SubCommits,
- gui.State.Contexts.Stash,
- gui.State.Contexts.Branches,
- gui.State.Contexts.RemoteBranches,
- gui.State.Contexts.Tags,
- } {
- controllers.AttachControllers(context, controllers.NewWorktreeOptionsController(common, context))
- }
-
controllers.AttachControllers(gui.State.Contexts.ReflogCommits,
reflogCommitsController,
)
@@ -306,11 +309,6 @@ func (gui *Gui) resetHelpersAndControllers() {
submodulesController,
)
- controllers.AttachControllers(gui.State.Contexts.LocalCommits,
- localCommitsController,
- bisectController,
- )
-
controllers.AttachControllers(gui.State.Contexts.Branches,
branchesController,
gitFlowController,
@@ -374,11 +372,11 @@ func (gui *Gui) resetHelpersAndControllers() {
)
controllers.AttachControllers(gui.State.Contexts.Global,
- syncController,
undoController,
globalController,
contextLinesController,
jumpToSideWindowController,
+ syncController,
)
controllers.AttachControllers(gui.State.Contexts.Snake,