Skip to content

Commit bfc0e74

Browse files
committed
Disable style tags in autocomplete list
1 parent 88f0d9a commit bfc0e74

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.18
55
require (
66
github.com/gdamore/tcell/v2 v2.7.1
77
github.com/kyoh86/xdg v1.2.0
8-
github.com/rivo/tview v0.0.0-20240307173318-e804876934a1
8+
github.com/rivo/tview v0.0.0-20241103174730-c76f7879f592
99
github.com/stretchr/testify v1.7.0
1010
golang.org/x/term v0.17.0
1111
)

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZ
1212
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
1313
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1414
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
15-
github.com/rivo/tview v0.0.0-20240307173318-e804876934a1 h1:bWLHTRekAy497pE7+nXSuzXwwFHI0XauRzz6roUvY+s=
16-
github.com/rivo/tview v0.0.0-20240307173318-e804876934a1/go.mod h1:02iFIz7K/A9jGCvrizLPvoqr4cEIx7q54RH5Qudkrss=
15+
github.com/rivo/tview v0.0.0-20241103174730-c76f7879f592 h1:YIJ+B1hePP6AgynC5TcqpO0H9k3SSoZa2BGyL6vDUzM=
16+
github.com/rivo/tview v0.0.0-20241103174730-c76f7879f592/go.mod h1:02iFIz7K/A9jGCvrizLPvoqr4cEIx7q54RH5Qudkrss=
1717
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
1818
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
1919
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=

main.go

+3-11
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"log"
2929
"os"
3030
"os/exec"
31-
"regexp"
3231
"path/filepath"
3332
"strings"
3433
"sync"
@@ -45,10 +44,6 @@ const defaultCommand string = "jq"
4544
// jq filter
4645
const specialChars string = ".-:$/"
4746

48-
// Regular expression used to escape style/region tags. Modified from tview so
49-
// that it does not attempt to escape plain numbers
50-
var nonEscapePattern = regexp.MustCompile(`(\[[a-zA-Z_,;: \-\."#]+\[*)\]`)
51-
5247
const alphabet string = "abcdefghijklmnopqrstuvwxyz"
5348

5449
var Version string
@@ -378,11 +373,7 @@ func createApp(doc Document) *tview.Application {
378373
}).
379374
SetAutocompleteFunc(func(text string) []string {
380375
if text == "" {
381-
var entries []string
382-
for _, item := range filterHistory.Items {
383-
entries = append(entries, nonEscapePattern.ReplaceAllString(item, "$1[]"))
384-
}
385-
return entries
376+
return filterHistory.Items
386377
}
387378

388379
if pos := strings.LastIndexByte(text, '.'); pos != -1 {
@@ -446,7 +437,8 @@ func createApp(doc Document) *tview.Application {
446437

447438
return nil
448439
}).
449-
SetAutocompleteStyles(tcell.ColorBlack, tcell.StyleDefault, tcell.StyleDefault.Reverse(true)).
440+
SetAutocompleteUseTags(false).
441+
SetAutocompleteStyles(tcell.ColorBlack, tcell.StyleDefault.Background(tcell.ColorBlack), tcell.StyleDefault.Reverse(true)).
450442
SetTitle("Filter").
451443
SetBorder(true)
452444

0 commit comments

Comments
 (0)