ui(git-grep): expose regexp mode in dropdown

This commit is contained in:
Shiny Nematoda 2024-08-16 13:23:25 +00:00 committed by Radosław Piliszek
parent 6d6116857c
commit 663e957d3d
8 changed files with 66 additions and 20 deletions

View file

@ -40,11 +40,22 @@ func CodeSearch(ctx *context.Context) {
language := ctx.FormTrim("l")
keyword := ctx.FormTrim("q")
isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
isFuzzy := true
if mode := ctx.FormTrim("mode"); len(mode) > 0 {
isFuzzy = mode == "fuzzy"
} else {
isFuzzy = ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
}
ctx.Data["Keyword"] = keyword
ctx.Data["Language"] = language
ctx.Data["CodeSearchOptions"] = []string{"exact", "fuzzy"}
ctx.Data["IsFuzzy"] = isFuzzy
if isFuzzy {
ctx.Data["CodeSearchMode"] = "fuzzy"
} else {
ctx.Data["CodeSearchMode"] = "exact"
}
ctx.Data["IsCodePage"] = true
if keyword == "" {