Skip to content

Commit

Permalink
prefix: don't trim query in order to allow prefixes with space in mod…
Browse files Browse the repository at this point in the history
…ules
  • Loading branch information
abenz1267 committed Feb 23, 2025
1 parent 368922b commit c0078bf
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions internal/ui/interactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ func process() {

elements.typeahead.SetText("")

text := strings.TrimSpace(elements.input.Text())
text := elements.input.Text()

text = trimArgumentDelimiter(text)

Expand Down Expand Up @@ -717,8 +717,6 @@ func processAsync(text string) {
appstate.IsSingle = true
}

hasEntryPrefix := false

for k := range p {
if p[k] == nil {
wg.Done()
Expand Down Expand Up @@ -774,6 +772,7 @@ func processAsync(text string) {
text = strings.TrimPrefix(text, w.General().Prefix)

e := w.Entries(text)
text = strings.TrimSpace(text)

toPush := []util.Entry{}
g := w.General()
Expand Down Expand Up @@ -843,8 +842,6 @@ func processAsync(text string) {
if toMatch == "" {
if e[k].ScoreFinal != 0 || config.Cfg.List.ShowInitialEntries {
if e[k].Prefix != "" && strings.HasPrefix(text, e[k].Prefix) {
hasEntryPrefix = true

toPush = append(toPush, e[k])
} else {
if e[k].IgnoreUnprefixed {
Expand All @@ -856,8 +853,6 @@ func processAsync(text string) {
}
} else {
if e[k].Prefix != "" && strings.HasPrefix(text, e[k].Prefix) {
hasEntryPrefix = true

toPush = append(toPush, e[k])
} else {
if e[k].IgnoreUnprefixed {
Expand Down Expand Up @@ -903,18 +898,6 @@ func processAsync(text string) {
return
}

if hasEntryPrefix {
finalEntries := []util.Entry{}

for _, v := range entries {
if v.Prefix != "" {
finalEntries = append(finalEntries, v)
}
}

entries = finalEntries
}

if !keepSort || text != "" {
sortEntries(entries, keepSort)
}
Expand Down

0 comments on commit c0078bf

Please sign in to comment.