mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-11 18:22:00 -07:00
Allow escaping meta characters with backslashes
One can escape meta characters in extended-search mode with backslashes. Prefixes: \' \! \^ Suffix: \$ Term separator: \<SPACE> To keep things simple, we are not going to support escaping of escaped sequences (e.g. \\') for matching them literally. Since this is a breaking change, we will bump the minor version. Close #444
This commit is contained in:
@@ -281,9 +281,13 @@ func defaultKeymap() map[int][]action {
|
||||
return keymap
|
||||
}
|
||||
|
||||
func trimQuery(query string) []rune {
|
||||
return []rune(strings.Replace(query, "\t", " ", -1))
|
||||
}
|
||||
|
||||
// NewTerminal returns new Terminal object
|
||||
func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
||||
input := []rune(opts.Query)
|
||||
input := trimQuery(opts.Query)
|
||||
var header []string
|
||||
if opts.Reverse {
|
||||
header = opts.Header
|
||||
@@ -1694,13 +1698,13 @@ func (t *Terminal) Loop() {
|
||||
case actPreviousHistory:
|
||||
if t.history != nil {
|
||||
t.history.override(string(t.input))
|
||||
t.input = []rune(t.history.previous())
|
||||
t.input = trimQuery(t.history.previous())
|
||||
t.cx = len(t.input)
|
||||
}
|
||||
case actNextHistory:
|
||||
if t.history != nil {
|
||||
t.history.override(string(t.input))
|
||||
t.input = []rune(t.history.next())
|
||||
t.input = trimQuery(t.history.next())
|
||||
t.cx = len(t.input)
|
||||
}
|
||||
case actSigStop:
|
||||
|
Reference in New Issue
Block a user