detached 217c6f0

fix(history): polish sidebar review follow-ups

commit
217c6f08bad24a633caf707592f0d61c4988db79
author
brice · · 2026-06-13 09:33 UTC
parent
1ee4e97
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +10 -6
M internal/ui/browser_window_history_sidebar.go +4 -2
@@ -28,10 +28,12 @@ func (bw *browserWindow) initHistorySidebar(ctx context.Context, a *App) {
2828 }
2929
3030 bw.historySidebar = sidebar
31- bw.sidebarVisible = false
3231
33- // Mount into the main window's sidebar box
32+ // Mount into the main window's sidebar box.
3433 bw.mainWindow.SetSidebarWidget(sidebar.Widget())
34+ bw.historySidebar.Hide()
35+ bw.mainWindow.SetSidebarVisible(false)
36+ bw.sidebarVisible = false
3537
3638 // Apply sidebar width from config, falling back to the default 320px.
3739 // The width is clamped to [280, 380] by SetSidebarWidth internally.
@@ -28,10 +28,12 @@ func (bw *browserWindow) initHistorySidebar(ctx context.Context, a *App) {
28 }28 }
29 29
30 bw.historySidebar = sidebar30 bw.historySidebar = sidebar
31- bw.sidebarVisible = false
32 31
33- // Mount into the main window's sidebar box32+ // Mount into the main window's sidebar box.
34 bw.mainWindow.SetSidebarWidget(sidebar.Widget())33 bw.mainWindow.SetSidebarWidget(sidebar.Widget())
34+ bw.historySidebar.Hide()
35+ bw.mainWindow.SetSidebarVisible(false)
36+ bw.sidebarVisible = false
35 37
36 // Apply sidebar width from config, falling back to the default 320px.38 // Apply sidebar width from config, falling back to the default 320px.
37 // The width is clamped to [280, 380] by SetSidebarWidth internally.39 // The width is clamped to [280, 380] by SetSidebarWidth internally.
M internal/ui/component/history_sidebar_rendering.go +6 -4
@@ -1,8 +1,6 @@
11 package component
22
33 import (
4- "fmt"
5-
64 "github.com/bnema/puregotk/v4/gtk"
75 "github.com/bnema/puregotk/v4/pango"
86
@@ -78,7 +76,7 @@ func (hs *HistorySidebar) showLoadingOrEmpty(query string, searchDone bool) {
7876 case query != "" && !searchDone:
7977 label.SetText("Searching...")
8078 case query != "":
81- label.SetText(fmt.Sprintf("No results for %q", query))
79+ label.SetText(noResultsText(query))
8280 default:
8381 label.SetText("No browsing history")
8482 }
@@ -97,6 +95,10 @@ func (hs *HistorySidebar) showLoadingOrEmpty(query string, searchDone bool) {
9795 hs.listBox.Append(&row.Widget)
9896 }
9997
98+func noResultsText(query string) string {
99+ return "No results for \"" + query + "\""
100+}
101+
100102 func (hs *HistorySidebar) showEmptyState(query string) {
101103 label := gtk.NewLabel(nil)
102104 if label == nil {
@@ -105,7 +107,7 @@ func (hs *HistorySidebar) showEmptyState(query string) {
105107 label.AddCssClass("history-sidebar-empty")
106108
107109 if query != "" {
108- label.SetText(fmt.Sprintf("No results for %q", query))
110+ label.SetText(noResultsText(query))
109111 } else {
110112 label.SetText("No browsing history")
111113 }
@@ -1,8 +1,6 @@
1 package component1 package component
2 2
3 import (3 import (
4- "fmt"
5-
6 "github.com/bnema/puregotk/v4/gtk"4 "github.com/bnema/puregotk/v4/gtk"
7 "github.com/bnema/puregotk/v4/pango"5 "github.com/bnema/puregotk/v4/pango"
8 6
@@ -78,7 +76,7 @@ func (hs *HistorySidebar) showLoadingOrEmpty(query string, searchDone bool) {
78 case query != "" && !searchDone:76 case query != "" && !searchDone:
79 label.SetText("Searching...")77 label.SetText("Searching...")
80 case query != "":78 case query != "":
81- label.SetText(fmt.Sprintf("No results for %q", query))79+ label.SetText(noResultsText(query))
82 default:80 default:
83 label.SetText("No browsing history")81 label.SetText("No browsing history")
84 }82 }
@@ -97,6 +95,10 @@ func (hs *HistorySidebar) showLoadingOrEmpty(query string, searchDone bool) {
97 hs.listBox.Append(&row.Widget)95 hs.listBox.Append(&row.Widget)
98 }96 }
99 97
98+func noResultsText(query string) string {
99+ return "No results for \"" + query + "\""
100+}
101+
100 func (hs *HistorySidebar) showEmptyState(query string) {102 func (hs *HistorySidebar) showEmptyState(query string) {
101 label := gtk.NewLabel(nil)103 label := gtk.NewLabel(nil)
102 if label == nil {104 if label == nil {
@@ -105,7 +107,7 @@ func (hs *HistorySidebar) showEmptyState(query string) {
105 label.AddCssClass("history-sidebar-empty")107 label.AddCssClass("history-sidebar-empty")
106 108
107 if query != "" {109 if query != "" {
108- label.SetText(fmt.Sprintf("No results for %q", query))110+ label.SetText(noResultsText(query))
109 } else {111 } else {
110 label.SetText("No browsing history")112 label.SetText("No browsing history")
111 }113 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close