Remove hasPrefix

pull/254/head
Vuong 3 years ago committed by GitHub
parent 6ef43d5ba0
commit f26006823b

@ -93,26 +93,20 @@ func (ct *Cointop) Search(q string) error {
ct.State.lastSearchQuery = q ct.State.lastSearchQuery = q
} }
hasPrefix := false
canSearchSymbol := true canSearchSymbol := true
canSearchName := true canSearchName := true
if strings.HasPrefix(q, "s:") { if strings.HasPrefix(q, "s:") {
canSearchSymbol = true canSearchSymbol = true
canSearchName = false canSearchName = false
hasPrefix = true q = q[2:]
log.Debug("Search, by keyword") log.Debug("Search, by keyword")
} }
if strings.HasPrefix(q, "n:") { if strings.HasPrefix(q, "n:") {
canSearchSymbol = false canSearchSymbol = false
canSearchName = true canSearchName = true
hasPrefix = true
log.Debug("Search, by name")
}
if hasPrefix {
q = q[2:] q = q[2:]
log.Debugf("Search, truncated query '%s'", q) log.Debug("Search, by name")
} }
idx := -1 idx := -1

Loading…
Cancel
Save