summaryrefslogtreecommitdiff
path: root/src/terminal_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/terminal_windows.go')
-rw-r--r--src/terminal_windows.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/terminal_windows.go b/src/terminal_windows.go
index 9de7ae45..d4262b65 100644
--- a/src/terminal_windows.go
+++ b/src/terminal_windows.go
@@ -4,6 +4,8 @@ package fzf
import (
"os"
+ "regexp"
+ "strings"
)
func notifyOnResize(resizeChan chan<- os.Signal) {
@@ -17,3 +19,12 @@ func notifyStop(p *os.Process) {
func notifyOnCont(resizeChan chan<- os.Signal) {
// NOOP
}
+
+func quoteEntry(entry string) string {
+ escaped := strings.Replace(entry, `\`, `\\`, -1)
+ escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`
+ r, _ := regexp.Compile(`[&|<>()@^%!"]`)
+ return r.ReplaceAllStringFunc(escaped, func(match string) string {
+ return "^" + match
+ })
+}