detached 157c30c

find: show active match in orange (.dumber-find-active) and manage active class on selection changes; resets on clear

commit
157c30c30e3e8d38340e9e4f6cabc8c97db39ca6
author
bamen · · 2025-09-09 19:22 UTC
committer
bamen · · 2025-09-09 19:36 UTC
parent
8ab9109
signature
unsigned
1 file · +7 -1
M pkg/webkit/ucm_js_cgo.go +7 -1
@@ -22,6 +22,7 @@ func getOmniboxScript() string {
2222 suggestions: [],
2323 matches: [], // {el, context}
2424 selectedIndex: -1,
25+ activeIndex: -1,
2526 debounceTimer: 0,
2627 highlightNodes: [],
2728 faded: false,
@@ -92,7 +93,7 @@ func getOmniboxScript() string {
9293 const list = document.createElement('div');
9394 list.style.cssText = 'margin-top:8px;max-height:50vh;overflow:auto;border-top:1px solid #333;';
9495 const style = document.createElement('style');
95- style.textContent = '.dumber-find-highlight{background:#ffeb3b;color:#000;padding:0 1px;border-radius:2px;box-shadow:0 0 0 1px #c8b900 inset}';
96+ style.textContent = '.dumber-find-highlight{background:#ffeb3b;color:#000;padding:0 1px;border-radius:2px;box-shadow:0 0 0 1px #c8b900 inset}.dumber-find-active{background:#ff9800 !important;color:#000;box-shadow:0 0 0 1px #b36b00 inset}';
9697 document.documentElement.appendChild(style);
9798 box.appendChild(input); box.appendChild(list); root.appendChild(box); document.documentElement.appendChild(root);
9899 H.box = box;
@@ -199,6 +200,7 @@ func getOmniboxScript() string {
199200 H.highlightNodes = [];
200201 H.matches = [];
201202 H.selectedIndex = -1;
203+ H.activeIndex = -1;
202204 H.paintList();
203205 },
204206 find(q){
@@ -248,7 +250,11 @@ func getOmniboxScript() string {
248250 H.revealSelection();
249251 },
250252 revealSelection(){
253+ const prev = H.matches[H.activeIndex|0];
254+ if (prev && prev.el && prev.el.classList) { prev.el.classList.remove('dumber-find-active'); }
251255 const m = H.matches[H.selectedIndex|0]; if (!m) return;
256+ if (m.el && m.el.classList) { m.el.classList.add('dumber-find-active'); }
257+ H.activeIndex = H.selectedIndex|0;
252258 try { m.el.scrollIntoView({block:'center', inline:'nearest'}); } catch(_){ m.el.scrollIntoView(); }
253259 },
254260 jump(delta){
@@ -22,6 +22,7 @@ func getOmniboxScript() string {
22 suggestions: [],22 suggestions: [],
23 matches: [], // {el, context}23 matches: [], // {el, context}
24 selectedIndex: -1,24 selectedIndex: -1,
25+ activeIndex: -1,
25 debounceTimer: 0,26 debounceTimer: 0,
26 highlightNodes: [],27 highlightNodes: [],
27 faded: false,28 faded: false,
@@ -92,7 +93,7 @@ func getOmniboxScript() string {
92 const list = document.createElement('div');93 const list = document.createElement('div');
93 list.style.cssText = 'margin-top:8px;max-height:50vh;overflow:auto;border-top:1px solid #333;';94 list.style.cssText = 'margin-top:8px;max-height:50vh;overflow:auto;border-top:1px solid #333;';
94 const style = document.createElement('style');95 const style = document.createElement('style');
95- style.textContent = '.dumber-find-highlight{background:#ffeb3b;color:#000;padding:0 1px;border-radius:2px;box-shadow:0 0 0 1px #c8b900 inset}';96+ style.textContent = '.dumber-find-highlight{background:#ffeb3b;color:#000;padding:0 1px;border-radius:2px;box-shadow:0 0 0 1px #c8b900 inset}.dumber-find-active{background:#ff9800 !important;color:#000;box-shadow:0 0 0 1px #b36b00 inset}';
96 document.documentElement.appendChild(style);97 document.documentElement.appendChild(style);
97 box.appendChild(input); box.appendChild(list); root.appendChild(box); document.documentElement.appendChild(root);98 box.appendChild(input); box.appendChild(list); root.appendChild(box); document.documentElement.appendChild(root);
98 H.box = box;99 H.box = box;
@@ -199,6 +200,7 @@ func getOmniboxScript() string {
199 H.highlightNodes = [];200 H.highlightNodes = [];
200 H.matches = [];201 H.matches = [];
201 H.selectedIndex = -1;202 H.selectedIndex = -1;
203+ H.activeIndex = -1;
202 H.paintList();204 H.paintList();
203 },205 },
204 find(q){206 find(q){
@@ -248,7 +250,11 @@ func getOmniboxScript() string {
248 H.revealSelection();250 H.revealSelection();
249 },251 },
250 revealSelection(){252 revealSelection(){
253+ const prev = H.matches[H.activeIndex|0];
254+ if (prev && prev.el && prev.el.classList) { prev.el.classList.remove('dumber-find-active'); }
251 const m = H.matches[H.selectedIndex|0]; if (!m) return;255 const m = H.matches[H.selectedIndex|0]; if (!m) return;
256+ if (m.el && m.el.classList) { m.el.classList.add('dumber-find-active'); }
257+ H.activeIndex = H.selectedIndex|0;
252 try { m.el.scrollIntoView({block:'center', inline:'nearest'}); } catch(_){ m.el.scrollIntoView(); }258 try { m.el.scrollIntoView({block:'center', inline:'nearest'}); } catch(_){ m.el.scrollIntoView(); }
253 },259 },
254 jump(delta){260 jump(delta){

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