find: add ; and : as right-context boundaries; Alt+Enter centers match without closing overlay (Shift+Enter previous)
- commit
- 87979c4af56bca8372b5130510aca611e10bb336
- author
- bamen · · 2025-09-09 21:29 UTC
- committer
- bamen · · 2025-09-09 18:52 UTC
- parent
- d736c5d
- signature
- unsigned
1 file · +11 -3
M pkg/webkit/ucm_js_cgo.go +11 -3
| @@ -63,8 +63,16 @@ func getOmniboxScript() string { | |||
| 63 | 63 | H.toggle(false); | |
| 64 | 64 | } else if (H.mode==='find' && e.key === 'Enter'){ | |
| 65 | 65 | e.preventDefault(); | |
| 66 | - | if (e.shiftKey) { H.jump(-1); } | |
| 67 | - | else { H.revealSelection(); H.close(); } | |
| 66 | + | if (e.shiftKey) { | |
| 67 | + | H.jump(-1); | |
| 68 | + | } else if (e.altKey) { | |
| 69 | + | // Center on current match but keep overlay open for further navigation | |
| 70 | + | H.revealSelection(); | |
| 71 | + | } else { | |
| 72 | + | // Default: center and close | |
| 73 | + | H.revealSelection(); | |
| 74 | + | H.close(); | |
| 75 | + | } | |
| 68 | 76 | } else if (e.key === 'ArrowDown' || e.key === 'ArrowUp'){ | |
| 69 | 77 | e.preventDefault(); | |
| 70 | 78 | const n = (H.mode==='find'? H.matches.length : H.suggestions.length); | |
| @@ -162,7 +170,7 @@ func getOmniboxScript() string { | |||
| 162 | 170 | H.highlightNodes.push({span, text: match}); | |
| 163 | 171 | const leftCtx = before.nodeValue.slice(-30); | |
| 164 | 172 | let rightRaw = afterVal.slice(0, 30); | |
| 165 | - | const boundaryIdx = rightRaw.search(/[.,-]/); | |
| 173 | + | const boundaryIdx = rightRaw.search(/[\.,;:\-]/); | |
| 166 | 174 | if (boundaryIdx !== -1) { | |
| 167 | 175 | rightRaw = rightRaw.slice(0, boundaryIdx+1); | |
| 168 | 176 | } | |
| @@ -63,8 +63,16 @@ func getOmniboxScript() string { | |||||
| 63 | H.toggle(false); | 63 | H.toggle(false); | ||
| 64 | } else if (H.mode==='find' && e.key === 'Enter'){ | 64 | } else if (H.mode==='find' && e.key === 'Enter'){ | ||
| 65 | e.preventDefault(); | 65 | e.preventDefault(); | ||
| 66 | - | if (e.shiftKey) { H.jump(-1); } | 66 | + | if (e.shiftKey) { |
| 67 | - | else { H.revealSelection(); H.close(); } | 67 | + | H.jump(-1); |
| 68 | + | } else if (e.altKey) { | |||
| 69 | + | // Center on current match but keep overlay open for further navigation | |||
| 70 | + | H.revealSelection(); | |||
| 71 | + | } else { | |||
| 72 | + | // Default: center and close | |||
| 73 | + | H.revealSelection(); | |||
| 74 | + | H.close(); | |||
| 75 | + | } | |||
| 68 | } else if (e.key === 'ArrowDown' || e.key === 'ArrowUp'){ | 76 | } else if (e.key === 'ArrowDown' || e.key === 'ArrowUp'){ | ||
| 69 | e.preventDefault(); | 77 | e.preventDefault(); | ||
| 70 | const n = (H.mode==='find'? H.matches.length : H.suggestions.length); | 78 | const n = (H.mode==='find'? H.matches.length : H.suggestions.length); | ||
| @@ -162,7 +170,7 @@ func getOmniboxScript() string { | |||||
| 162 | H.highlightNodes.push({span, text: match}); | 170 | H.highlightNodes.push({span, text: match}); | ||
| 163 | const leftCtx = before.nodeValue.slice(-30); | 171 | const leftCtx = before.nodeValue.slice(-30); | ||
| 164 | let rightRaw = afterVal.slice(0, 30); | 172 | let rightRaw = afterVal.slice(0, 30); | ||
| 165 | - | const boundaryIdx = rightRaw.search(/[.,-]/); | 173 | + | const boundaryIdx = rightRaw.search(/[\.,;:\-]/); |
| 166 | if (boundaryIdx !== -1) { | 174 | if (boundaryIdx !== -1) { | ||
| 167 | rightRaw = rightRaw.slice(0, boundaryIdx+1); | 175 | rightRaw = rightRaw.slice(0, boundaryIdx+1); | ||
| 168 | } | 176 | } | ||