From 0c1db1e813fd1c157df8180a9687f9f002c206da Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Fri, 8 Sep 2017 19:16:14 -0400 Subject: [PATCH] Escape regex chars in selections for multicursors Fixes #808 --- cmd/micro/actions.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/micro/actions.go b/cmd/micro/actions.go index 0b867878..732459b0 100644 --- a/cmd/micro/actions.go +++ b/cmd/micro/actions.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "regexp" "strconv" "strings" "time" @@ -1931,7 +1932,7 @@ func (v *View) SpawnMultiCursor(usePlugin bool) bool { searchStart = spawner.CurSelection[1] v.Cursor = c - Search(sel, v, true) + Search(regexp.QuoteMeta(sel), v, true) for _, cur := range v.Buf.cursors { if c.Loc == cur.Loc { @@ -1993,7 +1994,7 @@ func (v *View) SkipMultiCursor(usePlugin bool) bool { searchStart = cursor.CurSelection[1] v.Cursor = cursor - Search(sel, v, true) + Search(regexp.QuoteMeta(sel), v, true) v.Relocate() v.Cursor = cursor