main 5041353

bulk.go RawHistoryFolder

1package content
2
3import (
4	"context"
5	"maps"
6
7	"github.com/bnema/dumber/internal/application/port"
8	"github.com/bnema/dumber/internal/domain/entity"
9	"github.com/bnema/dumber/internal/logging"
10)
11
12// ApplyFiltersToAll applies content filters to all active webviews.
13// Called when filters become available after webviews were already created.
14func (c *Coordinator) ApplyFiltersToAll(ctx context.Context) {
15	log := logging.FromContext(ctx)
16	if c.filterApplier == nil {
17		log.Debug().Msg("ApplyFiltersToAll: no filter applier configured")
18		return
19	}
20
21	c.webViewsMu.RLock()
22	snapshot := make([]port.WebView, 0, len(c.webViews))
23	for _, wv := range c.webViews {
24		snapshot = append(snapshot, wv)
25	}
26	c.webViewsMu.RUnlock()
27
28	c.filterApplier.ApplyToAll(ctx, snapshot)
29	log.Debug().Int("count", len(snapshot)).Msg("applied filters to all webviews")
30}
31
32// ApplySettingsToAll reapplies engine settings to all active WebViews.
33func (c *Coordinator) ApplySettingsToAll(ctx context.Context) {
34	log := logging.FromContext(ctx)
35	if c.settingsApplier == nil {
36		log.Debug().Msg("ApplySettingsToAll: no settings applier configured")
37		return
38	}
39
40	c.webViewsMu.RLock()
41	snapshot := make([]port.WebView, 0, len(c.webViews))
42	for _, wv := range c.webViews {
43		snapshot = append(snapshot, wv)
44	}
45	c.webViewsMu.RUnlock()
46
47	c.settingsApplier.ApplyToAll(ctx, snapshot)
48	log.Debug().Int("count", len(snapshot)).Msg("applied settings to all webviews")
49}
50
51// RefreshInjectedScriptsToAll clears and re-injects user scripts into all active WebViews.
52//
53// WebKit user scripts are snapshotted when added to a WebKitUserContentManager, so when
54// appearance settings change at runtime (dark mode, palettes, UI scale), we must refresh
55// the scripts so future navigations pick up the latest values.
56// Script refresh is deferred for any WebView that is currently loading to avoid
57// removing scripts mid-navigation.
58func (c *Coordinator) RefreshInjectedScriptsToAll(ctx context.Context) {
59	log := logging.FromContext(ctx)
60	if c.injector == nil {
61		return
62	}
63
64	// Snapshot webViews under lock to avoid data race with concurrent popup create/close.
65	c.webViewsMu.RLock()
66	snapshot := make(map[entity.PaneID]port.WebView, len(c.webViews))
67	maps.Copy(snapshot, c.webViews)
68	c.webViewsMu.RUnlock()
69
70	for paneID, wv := range snapshot {
71		if wv == nil || wv.IsDestroyed() {
72			continue
73		}
74		if c.shouldDeferAppearance(wv) {
75			c.queueScriptRefresh(paneID)
76			log.Debug().Str("pane_id", string(paneID)).Msg("deferred script refresh until load finished")
77			continue
78		}
79
80		c.refreshInjectedScripts(ctx, c.injector, paneID, wv)
81	}
82}

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