From 69f77ee2f13d904e76c9324b9425b858672d51e5 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Fri, 8 Sep 2017 18:57:24 -0400 Subject: [PATCH] Set OrigSelection during search Fixes #807 --- cmd/micro/search.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/micro/search.go b/cmd/micro/search.go index 91b86345..8317fd0a 100644 --- a/cmd/micro/search.go +++ b/cmd/micro/search.go @@ -113,6 +113,8 @@ func searchDown(r *regexp.Regexp, v *View, start, end Loc) bool { if match != nil { v.Cursor.SetSelectionStart(Loc{charPos + runePos(match[0], string(l)), i}) v.Cursor.SetSelectionEnd(Loc{charPos + runePos(match[1], string(l)), i}) + v.Cursor.OrigSelection[0] = v.Cursor.CurSelection[0] + v.Cursor.OrigSelection[1] = v.Cursor.CurSelection[1] v.Cursor.Loc = v.Cursor.CurSelection[1] return true @@ -140,6 +142,8 @@ func searchUp(r *regexp.Regexp, v *View, start, end Loc) bool { if match != nil { v.Cursor.SetSelectionStart(Loc{runePos(match[0], string(l)), i}) v.Cursor.SetSelectionEnd(Loc{runePos(match[1], string(l)), i}) + v.Cursor.OrigSelection[0] = v.Cursor.CurSelection[0] + v.Cursor.OrigSelection[1] = v.Cursor.CurSelection[1] v.Cursor.Loc = v.Cursor.CurSelection[1] return true