detached cf4e6b2

refactor(popup): isolate source navigation hosting

commit
cf4e6b23172836c5685766394d1fcbc6defade16
author
brice · · 2026-07-27 07:55 UTC
parent
5992583
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +33 -17
M internal/ui/coordinator/content/popup_hosting.go +31 -0
@@ -60,6 +60,37 @@ func (pm *popupManager) openBrowserWindow(
6060 return popupWV
6161 }
6262
63+func (pm *popupManager) navigatePopupSource(
64+ ctx context.Context,
65+ parentID port.WebViewID,
66+ parentWV port.WebView,
67+ req port.PopupRequest,
68+ request dto.NewBrowsingContextRequest,
69+ decision dto.HostDecision,
70+) {
71+ log := logging.FromContext(ctx)
72+ popupWV, err := pm.createPopupWebView(ctx, parentID, req.TargetURI, false)
73+ if err != nil {
74+ logBrowsingContextFailure(*log, request, decision, dto.BrowsingContextFailureHostFailed, err)
75+ return
76+ }
77+ pm.setBrowsingContextDecision(popupWV, decision)
78+ popupWV.Destroy()
79+ if err := parentWV.LoadURI(ctx, req.TargetURI); err != nil {
80+ logBrowsingContextFailure(*log, request, decision, dto.BrowsingContextFailureHostFailed, err)
81+ }
82+}
83+
84+func (*popupManager) navigateSource(ctx context.Context, parentWV port.WebView, uri string) bool {
85+ if err := parentWV.LoadURI(ctx, uri); err != nil {
86+ logging.FromContext(ctx).Error().Err(err).
87+ Str("uri", logging.TruncateURL(uri, logURLMaxLen)).
88+ Msg("failed to load URI in source floating pane")
89+ return false
90+ }
91+ return true
92+}
93+
6394 func popupSupportsOpenerBridge(wv port.WebView) bool {
6495 _, ok := wv.(port.PopupOpenerCapable)
6596 return ok
@@ -60,6 +60,37 @@ func (pm *popupManager) openBrowserWindow(
60 return popupWV60 return popupWV
61 }61 }
62 62
63+func (pm *popupManager) navigatePopupSource(
64+ ctx context.Context,
65+ parentID port.WebViewID,
66+ parentWV port.WebView,
67+ req port.PopupRequest,
68+ request dto.NewBrowsingContextRequest,
69+ decision dto.HostDecision,
70+) {
71+ log := logging.FromContext(ctx)
72+ popupWV, err := pm.createPopupWebView(ctx, parentID, req.TargetURI, false)
73+ if err != nil {
74+ logBrowsingContextFailure(*log, request, decision, dto.BrowsingContextFailureHostFailed, err)
75+ return
76+ }
77+ pm.setBrowsingContextDecision(popupWV, decision)
78+ popupWV.Destroy()
79+ if err := parentWV.LoadURI(ctx, req.TargetURI); err != nil {
80+ logBrowsingContextFailure(*log, request, decision, dto.BrowsingContextFailureHostFailed, err)
81+ }
82+}
83+
84+func (*popupManager) navigateSource(ctx context.Context, parentWV port.WebView, uri string) bool {
85+ if err := parentWV.LoadURI(ctx, uri); err != nil {
86+ logging.FromContext(ctx).Error().Err(err).
87+ Str("uri", logging.TruncateURL(uri, logURLMaxLen)).
88+ Msg("failed to load URI in source floating pane")
89+ return false
90+ }
91+ return true
92+}
93+
63 func popupSupportsOpenerBridge(wv port.WebView) bool {94 func popupSupportsOpenerBridge(wv port.WebView) bool {
64 _, ok := wv.(port.PopupOpenerCapable)95 _, ok := wv.(port.PopupOpenerCapable)
65 return ok96 return ok
M internal/ui/coordinator/content/popup_manager.go +2 -17
@@ -592,16 +592,7 @@ func (pm *popupManager) handlePopupCreate(
592592 decision.ReuseContextName = ""
593593 decision.Reason = "named browsing context unavailable; creating replacement pane"
594594 case dto.HostDecisionNavigateSource:
595- popupWV, err := pm.createPopupWebView(ctx, parentID, req.TargetURI, false)
596- if err != nil {
597- logBrowsingContextFailure(*log, request, decision, dto.BrowsingContextFailureHostFailed, err)
598- return nil
599- }
600- pm.setBrowsingContextDecision(popupWV, decision)
601- popupWV.Destroy()
602- if err := parentWV.LoadURI(ctx, req.TargetURI); err != nil {
603- logBrowsingContextFailure(*log, request, decision, dto.BrowsingContextFailureHostFailed, err)
604- }
595+ pm.navigatePopupSource(ctx, parentID, parentWV, req, request, decision)
605596 return nil
606597 case dto.HostDecisionCreateBrowserWindow:
607598 return pm.openBrowserWindow(ctx, hooks, parentPaneID, parentID, req, decision, pm.readyOnCreate(req.Engine))
@@ -932,13 +923,7 @@ func (pm *popupManager) handleLinkMiddleClick(
932923 Str("reason", decision.Reason).
933924 Msg("middle-click browsing context host decision")
934925 if decision.Kind == dto.HostDecisionNavigateSource {
935- if err := parentWV.LoadURI(ctx, uri); err != nil {
936- log.Error().Err(err).
937- Str("uri", logging.TruncateURL(uri, logURLMaxLen)).
938- Msg("failed to load URI in source floating pane")
939- return false
940- }
941- return true
926+ return pm.navigateSource(ctx, parentWV, uri)
942927 }
943928 if decision.Kind == dto.HostDecisionCreateBrowserWindow {
944929 return pm.openMiddleClickBrowserWindow(ctx, hooks, parentPaneID, parentWV, uri, decision)
@@ -592,16 +592,7 @@ func (pm *popupManager) handlePopupCreate(
592 decision.ReuseContextName = ""592 decision.ReuseContextName = ""
593 decision.Reason = "named browsing context unavailable; creating replacement pane"593 decision.Reason = "named browsing context unavailable; creating replacement pane"
594 case dto.HostDecisionNavigateSource:594 case dto.HostDecisionNavigateSource:
595- popupWV, err := pm.createPopupWebView(ctx, parentID, req.TargetURI, false)595+ pm.navigatePopupSource(ctx, parentID, parentWV, req, request, decision)
596- if err != nil {
597- logBrowsingContextFailure(*log, request, decision, dto.BrowsingContextFailureHostFailed, err)
598- return nil
599- }
600- pm.setBrowsingContextDecision(popupWV, decision)
601- popupWV.Destroy()
602- if err := parentWV.LoadURI(ctx, req.TargetURI); err != nil {
603- logBrowsingContextFailure(*log, request, decision, dto.BrowsingContextFailureHostFailed, err)
604- }
605 return nil596 return nil
606 case dto.HostDecisionCreateBrowserWindow:597 case dto.HostDecisionCreateBrowserWindow:
607 return pm.openBrowserWindow(ctx, hooks, parentPaneID, parentID, req, decision, pm.readyOnCreate(req.Engine))598 return pm.openBrowserWindow(ctx, hooks, parentPaneID, parentID, req, decision, pm.readyOnCreate(req.Engine))
@@ -932,13 +923,7 @@ func (pm *popupManager) handleLinkMiddleClick(
932 Str("reason", decision.Reason).923 Str("reason", decision.Reason).
933 Msg("middle-click browsing context host decision")924 Msg("middle-click browsing context host decision")
934 if decision.Kind == dto.HostDecisionNavigateSource {925 if decision.Kind == dto.HostDecisionNavigateSource {
935- if err := parentWV.LoadURI(ctx, uri); err != nil {926+ return pm.navigateSource(ctx, parentWV, uri)
936- log.Error().Err(err).
937- Str("uri", logging.TruncateURL(uri, logURLMaxLen)).
938- Msg("failed to load URI in source floating pane")
939- return false
940- }
941- return true
942 }927 }
943 if decision.Kind == dto.HostDecisionCreateBrowserWindow {928 if decision.Kind == dto.HostDecisionCreateBrowserWindow {
944 return pm.openMiddleClickBrowserWindow(ctx, hooks, parentPaneID, parentWV, uri, decision)929 return pm.openMiddleClickBrowserWindow(ctx, hooks, parentPaneID, parentWV, uri, decision)

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