Merge branch 'main' into fix/truncate-space-before-url
1 file · +7 -0
M internal/ui/component/omnibox.go +7 -0
| @@ -30,6 +30,7 @@ const ( | |||
| 30 | 30 | defaultOmniboxPlaceholder = "Search history or enter URL… (! lists bangs)" | |
| 31 | 31 | ghostPositionRetryMs = 16 | |
| 32 | 32 | ghostPositionMaxAttempts = 5 | |
| 33 | + | minGhostInputLength = 1 | |
| 33 | 34 | ) | |
| 34 | 35 | ||
| 35 | 36 | // ViewMode distinguishes history search from favorites display. | |
| @@ -1091,6 +1092,7 @@ func (o *Omnibox) updateGhostFromSelectionWithInput(entryText string) { | |||
| 1091 | 1092 | idx := o.selectedIndex | |
| 1092 | 1093 | mode := o.viewMode | |
| 1093 | 1094 | bangMode := o.bangMode | |
| 1095 | + | hasNavigated := o.hasNavigated | |
| 1094 | 1096 | suggestions := o.suggestions | |
| 1095 | 1097 | favorites := o.favorites | |
| 1096 | 1098 | o.mu.RUnlock() | |
| @@ -1101,6 +1103,11 @@ func (o *Omnibox) updateGhostFromSelectionWithInput(entryText string) { | |||
| 1101 | 1103 | return | |
| 1102 | 1104 | } | |
| 1103 | 1105 | ||
| 1106 | + | if utf8.RuneCountInString(entryText) < minGhostInputLength && !hasNavigated { | |
| 1107 | + | o.clearGhostTextIfInput(entryText) | |
| 1108 | + | return | |
| 1109 | + | } | |
| 1110 | + | ||
| 1104 | 1111 | if entryText != "" { | |
| 1105 | 1112 | o.resolveGhostCompletion(entryText, mode, suggestions, favorites) | |
| 1106 | 1113 | return | |
| @@ -30,6 +30,7 @@ const ( | |||||
| 30 | defaultOmniboxPlaceholder = "Search history or enter URL… (! lists bangs)" | 30 | defaultOmniboxPlaceholder = "Search history or enter URL… (! lists bangs)" | ||
| 31 | ghostPositionRetryMs = 16 | 31 | ghostPositionRetryMs = 16 | ||
| 32 | ghostPositionMaxAttempts = 5 | 32 | ghostPositionMaxAttempts = 5 | ||
| 33 | + | minGhostInputLength = 1 | |||
| 33 | ) | 34 | ) | ||
| 34 | 35 | ||||
| 35 | // ViewMode distinguishes history search from favorites display. | 36 | // ViewMode distinguishes history search from favorites display. | ||
| @@ -1091,6 +1092,7 @@ func (o *Omnibox) updateGhostFromSelectionWithInput(entryText string) { | |||||
| 1091 | idx := o.selectedIndex | 1092 | idx := o.selectedIndex | ||
| 1092 | mode := o.viewMode | 1093 | mode := o.viewMode | ||
| 1093 | bangMode := o.bangMode | 1094 | bangMode := o.bangMode | ||
| 1095 | + | hasNavigated := o.hasNavigated | |||
| 1094 | suggestions := o.suggestions | 1096 | suggestions := o.suggestions | ||
| 1095 | favorites := o.favorites | 1097 | favorites := o.favorites | ||
| 1096 | o.mu.RUnlock() | 1098 | o.mu.RUnlock() | ||
| @@ -1101,6 +1103,11 @@ func (o *Omnibox) updateGhostFromSelectionWithInput(entryText string) { | |||||
| 1101 | return | 1103 | return | ||
| 1102 | } | 1104 | } | ||
| 1103 | 1105 | ||||
| 1106 | + | if utf8.RuneCountInString(entryText) < minGhostInputLength && !hasNavigated { | |||
| 1107 | + | o.clearGhostTextIfInput(entryText) | |||
| 1108 | + | return | |||
| 1109 | + | } | |||
| 1110 | + | ||||
| 1104 | if entryText != "" { | 1111 | if entryText != "" { | ||
| 1105 | o.resolveGhostCompletion(entryText, mode, suggestions, favorites) | 1112 | o.resolveGhostCompletion(entryText, mode, suggestions, favorites) | ||
| 1106 | return | 1113 | return | ||