397288d590d84378b178889447332e4a3ff66c3e

Author
Eldon <github@eldondev.com>
Committer
GitHub <noreply@github.com>
Date

Message

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.

Diff

 1diff --git a/pkg/ui/keymap/keymap.go b/pkg/ui/keymap/keymap.go
 2index ad5d8fa736c7c9bda1c8b534d15fed084602ef76..707a558616cec72ec85e1a07cde964e25930ce4d 100644
 3--- a/pkg/ui/keymap/keymap.go
 4+++ b/pkg/ui/keymap/keymap.go
 5@@ -198,7 +198,7 @@ func DefaultKeyMap() *KeyMap {
 6 			"right",
 7 		),
 8 		key.WithHelp(
 9-			"→",
10+			"→/l",
11 			"select",
12 		),
13 	)
14@@ -210,7 +210,7 @@ func DefaultKeyMap() *KeyMap {
15 			"backspace",
16 		),
17 		key.WithHelp(
18-			"←",
19+			"←/h",
20 			"back",
21 		),
22 	)
23diff --git a/pkg/ui/pages/repo/files.go b/pkg/ui/pages/repo/files.go
24index 88c9b5802dfcfcefcfb13f2d0cac2c8715c780e9..7ae477e8cb73b86320d4f2b44da60cd8d6c63c13 100644
25--- a/pkg/ui/pages/repo/files.go
26+++ b/pkg/ui/pages/repo/files.go
27@@ -151,17 +151,7 @@ func (f *Files) ShortHelp() []key.Binding {
28 func (f *Files) FullHelp() [][]key.Binding {
29 	b := make([][]key.Binding, 0)
30 	copyKey := f.common.KeyMap.Copy
31-	actionKeys := []key.Binding{
32-		copyKey,
33-	}
34-	if !f.code.UseGlamour {
35-		actionKeys = append(actionKeys, lineNo)
36-	}
37-	actionKeys = append(actionKeys, blameView)
38-	if common.IsFileMarkdown(f.currentContent.content, f.currentContent.ext) &&
39-		!f.blameView {
40-		actionKeys = append(actionKeys, preview)
41-	}
42+	actionKeys := []key.Binding{}
43 	switch f.activeView {
44 	case filesViewFiles:
45 		copyKey.SetHelp("c", "copy name")
46@@ -183,6 +173,14 @@ func (f *Files) FullHelp() [][]key.Binding {
47 			},
48 		}...)
49 	case filesViewContent:
50+		if !f.code.UseGlamour {
51+			actionKeys = append(actionKeys, lineNo)
52+		}
53+		actionKeys = append(actionKeys, blameView)
54+		if common.IsFileMarkdown(f.currentContent.content, f.currentContent.ext) &&
55+			!f.blameView {
56+			actionKeys = append(actionKeys, preview)
57+		}
58 		copyKey.SetHelp("c", "copy content")
59 		k := f.code.KeyMap
60 		b = append(b, []key.Binding{
61@@ -203,6 +201,9 @@ func (f *Files) FullHelp() [][]key.Binding {
62 			},
63 		}...)
64 	}
65+	actionKeys = append([]key.Binding{
66+		copyKey,
67+	}, actionKeys...)
68 	return append(b, actionKeys)
69 }
70