detached 5740371

refactor(context): pass context as first parameter to webkit and ui methods

commit
5740371e3aa1920a4b4997159164a095c325b3a1
author
brice · · 2025-12-16 20:14 UTC
committer
brice · · 2025-12-16 17:16 UTC
parent
bce8d5b
signature
unsigned
5 files · +12 -14
M internal/infrastructure/webkit/webview.go +2 -2
@@ -143,7 +143,7 @@ func NewWebView(ctx context.Context, wkCtx *WebKitContext, settings *SettingsMan
143143
144144 // Apply settings if provided
145145 if settings != nil {
146- settings.ApplyToWebView(inner)
146+ settings.ApplyToWebView(ctx, inner)
147147 }
148148
149149 // Connect signals
@@ -181,7 +181,7 @@ func NewWebViewWithRelated(ctx context.Context, parent *WebView, settings *Setti
181181 wv.id = globalRegistry.register(wv)
182182
183183 if settings != nil {
184- settings.ApplyToWebView(inner)
184+ settings.ApplyToWebView(ctx, inner)
185185 }
186186
187187 wv.connectSignals()
@@ -143,7 +143,7 @@ func NewWebView(ctx context.Context, wkCtx *WebKitContext, settings *SettingsMan
143 143
144 // Apply settings if provided144 // Apply settings if provided
145 if settings != nil {145 if settings != nil {
146- settings.ApplyToWebView(inner)146+ settings.ApplyToWebView(ctx, inner)
147 }147 }
148 148
149 // Connect signals149 // Connect signals
@@ -181,7 +181,7 @@ func NewWebViewWithRelated(ctx context.Context, parent *WebView, settings *Setti
181 wv.id = globalRegistry.register(wv)181 wv.id = globalRegistry.register(wv)
182 182
183 if settings != nil {183 if settings != nil {
184- settings.ApplyToWebView(inner)184+ settings.ApplyToWebView(ctx, inner)
185 }185 }
186 186
187 wv.connectSignals()187 wv.connectSignals()
M internal/ui/component/workspace_view.go +2 -2
@@ -110,7 +110,7 @@ func NewWorkspaceView(ctx context.Context, factory layout.WidgetFactory) *Worksp
110110 }
111111
112112 // SetWorkspace sets the workspace to render and builds the widget tree.
113-func (wv *WorkspaceView) SetWorkspace(ws *entity.Workspace) error {
113+func (wv *WorkspaceView) SetWorkspace(ctx context.Context, ws *entity.Workspace) error {
114114 if ws == nil {
115115 return ErrNilWorkspace
116116 }
@@ -240,7 +240,7 @@ func (wv *WorkspaceView) Rebuild(ctx context.Context) error {
240240 return ErrNilWorkspace
241241 }
242242
243- return wv.SetWorkspace(ws)
243+ return wv.SetWorkspace(ctx, ws)
244244 }
245245
246246 // FocusPane attempts to give focus to a specific pane.
@@ -110,7 +110,7 @@ func NewWorkspaceView(ctx context.Context, factory layout.WidgetFactory) *Worksp
110 }110 }
111 111
112 // SetWorkspace sets the workspace to render and builds the widget tree.112 // SetWorkspace sets the workspace to render and builds the widget tree.
113-func (wv *WorkspaceView) SetWorkspace(ws *entity.Workspace) error {113+func (wv *WorkspaceView) SetWorkspace(ctx context.Context, ws *entity.Workspace) error {
114 if ws == nil {114 if ws == nil {
115 return ErrNilWorkspace115 return ErrNilWorkspace
116 }116 }
@@ -240,7 +240,7 @@ func (wv *WorkspaceView) Rebuild(ctx context.Context) error {
240 return ErrNilWorkspace240 return ErrNilWorkspace
241 }241 }
242 242
243- return wv.SetWorkspace(ws)243+ return wv.SetWorkspace(ctx, ws)
244 }244 }
245 245
246 // FocusPane attempts to give focus to a specific pane.246 // FocusPane attempts to give focus to a specific pane.
M internal/ui/controller/tab_controller.go +0 -1
@@ -9,7 +9,6 @@ import (
99 "github.com/bnema/dumber/internal/domain/entity"
1010 "github.com/bnema/dumber/internal/logging"
1111 "github.com/bnema/dumber/internal/ui/component"
12- "github.com/rs/zerolog"
1312 )
1413
1514 // TabController synchronizes TabList domain state with the TabBar UI widget.
@@ -9,7 +9,6 @@ import (
9 "github.com/bnema/dumber/internal/domain/entity"9 "github.com/bnema/dumber/internal/domain/entity"
10 "github.com/bnema/dumber/internal/logging"10 "github.com/bnema/dumber/internal/logging"
11 "github.com/bnema/dumber/internal/ui/component"11 "github.com/bnema/dumber/internal/ui/component"
12- "github.com/rs/zerolog"
13 )12 )
14 13
15 // TabController synchronizes TabList domain state with the TabBar UI widget.14 // TabController synchronizes TabList domain state with the TabBar UI widget.
M internal/ui/input/keyboard.go +0 -1
@@ -9,7 +9,6 @@ import (
99 "github.com/bnema/dumber/internal/logging"
1010 "github.com/jwijenbergh/puregotk/v4/gdk"
1111 "github.com/jwijenbergh/puregotk/v4/gtk"
12- "github.com/rs/zerolog"
1312 )
1413
1514 // ActionHandler is called when a keyboard action is triggered.
@@ -9,7 +9,6 @@ import (
9 "github.com/bnema/dumber/internal/logging"9 "github.com/bnema/dumber/internal/logging"
10 "github.com/jwijenbergh/puregotk/v4/gdk"10 "github.com/jwijenbergh/puregotk/v4/gdk"
11 "github.com/jwijenbergh/puregotk/v4/gtk"11 "github.com/jwijenbergh/puregotk/v4/gtk"
12- "github.com/rs/zerolog"
13 )12 )
14 13
15 // ActionHandler is called when a keyboard action is triggered.14 // ActionHandler is called when a keyboard action is triggered.
M internal/ui/input/modal.go +8 -8
@@ -71,7 +71,7 @@ func (m *ModalState) EnterTabMode(ctx context.Context, timeout time.Duration) {
7171
7272 if m.mode == ModeTab {
7373 // Already in tab mode, just reset timeout
74- m.resetTimeoutLocked(timeout)
74+ m.resetTimeoutLocked(ctx, timeout)
7575 return
7676 }
7777
@@ -82,7 +82,7 @@ func (m *ModalState) EnterTabMode(ctx context.Context, timeout time.Duration) {
8282
8383 if timeout > 0 {
8484 m.timer = time.AfterFunc(timeout, func() {
85- m.ExitMode()
85+ m.ExitMode(ctx)
8686 })
8787 }
8888
@@ -106,7 +106,7 @@ func (m *ModalState) EnterPaneMode(ctx context.Context, timeout time.Duration) {
106106
107107 if m.mode == ModePane {
108108 // Already in pane mode, just reset timeout
109- m.resetTimeoutLocked(timeout)
109+ m.resetTimeoutLocked(ctx, timeout)
110110 return
111111 }
112112
@@ -117,7 +117,7 @@ func (m *ModalState) EnterPaneMode(ctx context.Context, timeout time.Duration) {
117117
118118 if timeout > 0 {
119119 m.timer = time.AfterFunc(timeout, func() {
120- m.ExitMode()
120+ m.ExitMode(ctx)
121121 })
122122 }
123123
@@ -159,7 +159,7 @@ func (m *ModalState) ExitMode(ctx context.Context) {
159159
160160 // ResetTimeout restarts the mode timeout (e.g., after a valid keystroke).
161161 // Does nothing if not in a modal mode or if no timeout was set.
162-func (m *ModalState) ResetTimeout() {
162+func (m *ModalState) ResetTimeout(ctx context.Context) {
163163 m.mu.Lock()
164164 defer m.mu.Unlock()
165165
@@ -167,7 +167,7 @@ func (m *ModalState) ResetTimeout() {
167167 return
168168 }
169169
170- m.resetTimeoutLocked(m.timeout)
170+ m.resetTimeoutLocked(ctx, m.timeout)
171171 }
172172
173173 // SetOnModeChange sets the callback for mode changes.
@@ -189,12 +189,12 @@ func (m *ModalState) cancelTimerLocked() {
189189
190190 // resetTimeoutLocked resets the timeout timer.
191191 // Must be called with m.mu held.
192-func (m *ModalState) resetTimeoutLocked(timeout time.Duration) {
192+func (m *ModalState) resetTimeoutLocked(ctx context.Context, timeout time.Duration) {
193193 m.cancelTimerLocked()
194194 m.timeout = timeout
195195 if timeout > 0 {
196196 m.timer = time.AfterFunc(timeout, func() {
197- m.ExitMode()
197+ m.ExitMode(ctx)
198198 })
199199 }
200200 }
@@ -71,7 +71,7 @@ func (m *ModalState) EnterTabMode(ctx context.Context, timeout time.Duration) {
71 71
72 if m.mode == ModeTab {72 if m.mode == ModeTab {
73 // Already in tab mode, just reset timeout73 // Already in tab mode, just reset timeout
74- m.resetTimeoutLocked(timeout)74+ m.resetTimeoutLocked(ctx, timeout)
75 return75 return
76 }76 }
77 77
@@ -82,7 +82,7 @@ func (m *ModalState) EnterTabMode(ctx context.Context, timeout time.Duration) {
82 82
83 if timeout > 0 {83 if timeout > 0 {
84 m.timer = time.AfterFunc(timeout, func() {84 m.timer = time.AfterFunc(timeout, func() {
85- m.ExitMode()85+ m.ExitMode(ctx)
86 })86 })
87 }87 }
88 88
@@ -106,7 +106,7 @@ func (m *ModalState) EnterPaneMode(ctx context.Context, timeout time.Duration) {
106 106
107 if m.mode == ModePane {107 if m.mode == ModePane {
108 // Already in pane mode, just reset timeout108 // Already in pane mode, just reset timeout
109- m.resetTimeoutLocked(timeout)109+ m.resetTimeoutLocked(ctx, timeout)
110 return110 return
111 }111 }
112 112
@@ -117,7 +117,7 @@ func (m *ModalState) EnterPaneMode(ctx context.Context, timeout time.Duration) {
117 117
118 if timeout > 0 {118 if timeout > 0 {
119 m.timer = time.AfterFunc(timeout, func() {119 m.timer = time.AfterFunc(timeout, func() {
120- m.ExitMode()120+ m.ExitMode(ctx)
121 })121 })
122 }122 }
123 123
@@ -159,7 +159,7 @@ func (m *ModalState) ExitMode(ctx context.Context) {
159 159
160 // ResetTimeout restarts the mode timeout (e.g., after a valid keystroke).160 // ResetTimeout restarts the mode timeout (e.g., after a valid keystroke).
161 // Does nothing if not in a modal mode or if no timeout was set.161 // Does nothing if not in a modal mode or if no timeout was set.
162-func (m *ModalState) ResetTimeout() {162+func (m *ModalState) ResetTimeout(ctx context.Context) {
163 m.mu.Lock()163 m.mu.Lock()
164 defer m.mu.Unlock()164 defer m.mu.Unlock()
165 165
@@ -167,7 +167,7 @@ func (m *ModalState) ResetTimeout() {
167 return167 return
168 }168 }
169 169
170- m.resetTimeoutLocked(m.timeout)170+ m.resetTimeoutLocked(ctx, m.timeout)
171 }171 }
172 172
173 // SetOnModeChange sets the callback for mode changes.173 // SetOnModeChange sets the callback for mode changes.
@@ -189,12 +189,12 @@ func (m *ModalState) cancelTimerLocked() {
189 189
190 // resetTimeoutLocked resets the timeout timer.190 // resetTimeoutLocked resets the timeout timer.
191 // Must be called with m.mu held.191 // Must be called with m.mu held.
192-func (m *ModalState) resetTimeoutLocked(timeout time.Duration) {192+func (m *ModalState) resetTimeoutLocked(ctx context.Context, timeout time.Duration) {
193 m.cancelTimerLocked()193 m.cancelTimerLocked()
194 m.timeout = timeout194 m.timeout = timeout
195 if timeout > 0 {195 if timeout > 0 {
196 m.timer = time.AfterFunc(timeout, func() {196 m.timer = time.AfterFunc(timeout, func() {
197- m.ExitMode()197+ m.ExitMode(ctx)
198 })198 })
199 }199 }
200 }200 }

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