detached 0ede461

fix(url): fix omnibox URL detection for dumb:// scheme

commit
0ede461f611d4fcd770c1319ca22ebdd0ccb9e08
author
brice · · 2025-12-22 06:18 UTC
parent
b0d67b5
signature
unsigned
2 files · +23 -0
M internal/domain/url/normalize.go +16 -0
@@ -37,10 +37,26 @@ func Normalize(input string) string {
3737
3838 // LooksLikeURL checks if the input appears to be a URL (not a search query).
3939 // Returns true for strings like "github.com", "google.com/search", etc.
40+// Also returns true for URLs with explicit schemes like "dumb://".
4041 func LooksLikeURL(input string) bool {
4142 if input == "" {
4243 return false
4344 }
45+
46+ // Explicit schemes should always be treated as URLs.
47+ switch {
48+ case strings.HasPrefix(input, "http://"):
49+ return true
50+ case strings.HasPrefix(input, "https://"):
51+ return true
52+ case strings.HasPrefix(input, "dumb://"):
53+ return true
54+ case strings.HasPrefix(input, "file://"):
55+ return true
56+ case strings.HasPrefix(input, "about:"):
57+ return true
58+ }
59+
4460 // Contains a dot and no spaces = likely a URL
4561 return strings.Contains(input, ".") && !strings.Contains(input, " ")
4662 }
@@ -37,10 +37,26 @@ func Normalize(input string) string {
37 37
38 // LooksLikeURL checks if the input appears to be a URL (not a search query).38 // LooksLikeURL checks if the input appears to be a URL (not a search query).
39 // Returns true for strings like "github.com", "google.com/search", etc.39 // Returns true for strings like "github.com", "google.com/search", etc.
40+// Also returns true for URLs with explicit schemes like "dumb://".
40 func LooksLikeURL(input string) bool {41 func LooksLikeURL(input string) bool {
41 if input == "" {42 if input == "" {
42 return false43 return false
43 }44 }
45+
46+ // Explicit schemes should always be treated as URLs.
47+ switch {
48+ case strings.HasPrefix(input, "http://"):
49+ return true
50+ case strings.HasPrefix(input, "https://"):
51+ return true
52+ case strings.HasPrefix(input, "dumb://"):
53+ return true
54+ case strings.HasPrefix(input, "file://"):
55+ return true
56+ case strings.HasPrefix(input, "about:"):
57+ return true
58+ }
59+
44 // Contains a dot and no spaces = likely a URL60 // Contains a dot and no spaces = likely a URL
45 return strings.Contains(input, ".") && !strings.Contains(input, " ")61 return strings.Contains(input, ".") && !strings.Contains(input, " ")
46 }62 }
M internal/domain/url/search_test.go +7 -0
@@ -69,6 +69,13 @@ func TestBuildSearchURL(t *testing.T) {
6969 defaultSearch: testDefaultSearch,
7070 want: "https://example.com",
7171 },
72+ {
73+ name: "custom scheme dumb unchanged",
74+ input: "dumb://settings",
75+ shortcuts: testShortcuts,
76+ defaultSearch: testDefaultSearch,
77+ want: "dumb://settings",
78+ },
7279 {
7380 name: "plain search query uses default",
7481 input: "how to parse json",
@@ -69,6 +69,13 @@ func TestBuildSearchURL(t *testing.T) {
69 defaultSearch: testDefaultSearch,69 defaultSearch: testDefaultSearch,
70 want: "https://example.com",70 want: "https://example.com",
71 },71 },
72+ {
73+ name: "custom scheme dumb unchanged",
74+ input: "dumb://settings",
75+ shortcuts: testShortcuts,
76+ defaultSearch: testDefaultSearch,
77+ want: "dumb://settings",
78+ },
72 {79 {
73 name: "plain search query uses default",80 name: "plain search query uses default",
74 input: "how to parse json",81 input: "how to parse json",

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