From 397288d590d84378b178889447332e4a3ff66c3e Mon Sep 17 00:00:00 2001 From: Eldon Date: Wed, 9 Jul 2025 15:03:55 +0000 Subject: [PATCH] fix(ui): help menu on file list view (#719) * fix(ui): Add additional key function indicators Add the h and l indications in the help message when those keys select items from lists. * fix(ui); Fix action long help on file views Prior to this commit, the copy command help was not overwritten as intended, and blame and toggle line number options were shown in help on the file list view page, but only functioned on the file content view page. --- pkg/ui/keymap/keymap.go | 4 ++-- pkg/ui/pages/repo/files.go | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/pkg/ui/keymap/keymap.go b/pkg/ui/keymap/keymap.go index ad5d8fa736c7c9bda1c8b534d15fed084602ef76..707a558616cec72ec85e1a07cde964e25930ce4d 100644 --- a/pkg/ui/keymap/keymap.go +++ b/pkg/ui/keymap/keymap.go @@ -198,7 +198,7 @@ func DefaultKeyMap() *KeyMap { "right", ), key.WithHelp( - "→", + "→/l", "select", ), ) @@ -210,7 +210,7 @@ func DefaultKeyMap() *KeyMap { "backspace", ), key.WithHelp( - "←", + "←/h", "back", ), ) diff --git a/pkg/ui/pages/repo/files.go b/pkg/ui/pages/repo/files.go index 88c9b5802dfcfcefcfb13f2d0cac2c8715c780e9..7ae477e8cb73b86320d4f2b44da60cd8d6c63c13 100644 --- a/pkg/ui/pages/repo/files.go +++ b/pkg/ui/pages/repo/files.go @@ -151,17 +151,7 @@ func (f *Files) ShortHelp() []key.Binding { func (f *Files) FullHelp() [][]key.Binding { b := make([][]key.Binding, 0) copyKey := f.common.KeyMap.Copy - actionKeys := []key.Binding{ - copyKey, - } - if !f.code.UseGlamour { - actionKeys = append(actionKeys, lineNo) - } - actionKeys = append(actionKeys, blameView) - if common.IsFileMarkdown(f.currentContent.content, f.currentContent.ext) && - !f.blameView { - actionKeys = append(actionKeys, preview) - } + actionKeys := []key.Binding{} switch f.activeView { case filesViewFiles: copyKey.SetHelp("c", "copy name") @@ -183,6 +173,14 @@ func (f *Files) FullHelp() [][]key.Binding { }, }...) case filesViewContent: + if !f.code.UseGlamour { + actionKeys = append(actionKeys, lineNo) + } + actionKeys = append(actionKeys, blameView) + if common.IsFileMarkdown(f.currentContent.content, f.currentContent.ext) && + !f.blameView { + actionKeys = append(actionKeys, preview) + } copyKey.SetHelp("c", "copy content") k := f.code.KeyMap b = append(b, []key.Binding{ @@ -203,6 +201,9 @@ func (f *Files) FullHelp() [][]key.Binding { }, }...) } + actionKeys = append([]key.Binding{ + copyKey, + }, actionKeys...) return append(b, actionKeys) }