From 2faaf4e045c680f039596295f1ffd8efa3f83d1c Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Sat, 28 May 2022 20:19:39 -0400 Subject: [PATCH] fix: print err don't panic and in the case of regex compile failing on menu find --- readline/comp-group.go | 1 + readline/tabfind.go | 1 + 2 files changed, 2 insertions(+) diff --git a/readline/comp-group.go b/readline/comp-group.go index ecf59b4..6a6e7bc 100644 --- a/readline/comp-group.go +++ b/readline/comp-group.go @@ -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]]) { diff --git a/readline/tabfind.go b/readline/tabfind.go index 5abe307..aa38259 100644 --- a/readline/tabfind.go +++ b/readline/tabfind.go @@ -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")) }