fix: print err don't panic and in the case of regex compile failing on menu find

runner-prompt
TorchedSammy 2022-05-28 20:19:39 -04:00
parent 3990d370fa
commit 2faaf4e045
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 2 additions and 0 deletions

View File

@ -73,6 +73,7 @@ func (g *CompletionGroup) updateTabFind(rl *Instance) {
// We perform filter right here, so we create a new completion group, and populate it with our results.
for i := range g.Suggestions {
if rl.regexSearch == nil { continue }
if rl.regexSearch.MatchString(g.Suggestions[i]) {
suggs = append(suggs, g.Suggestions[i])
} else if g.DisplayType == TabDisplayList && rl.regexSearch.MatchString(g.Descriptions[g.Suggestions[i]]) {

View File

@ -33,6 +33,7 @@ func (rl *Instance) updateTabFind(r []rune) {
var err error
rl.regexSearch, err = regexp.Compile("(?i)" + string(rl.tfLine))
if err != nil {
rl.RefreshPromptLog(err.Error())
rl.infoText = []rune(Red("Failed to match search regexp"))
}