File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1072,8 +1072,20 @@ func (h *BufPane) UnhighlightSearch() bool {
10721072 return true
10731073}
10741074
1075+ // ResetSearch resets the last used search term
1076+ func (h * BufPane ) ResetSearch () bool {
1077+ if h .Buf .LastSearch != "" {
1078+ h .Buf .LastSearch = ""
1079+ return true
1080+ }
1081+ return false
1082+ }
1083+
10751084// FindNext searches forwards for the last used search term
10761085func (h * BufPane ) FindNext () bool {
1086+ if h .Buf .LastSearch == "" {
1087+ return false
1088+ }
10771089 // If the cursor is at the start of a selection and we search we want
10781090 // to search from the end of the selection in the case that
10791091 // the selection is a search result in which case we wouldn't move at
@@ -1100,6 +1112,9 @@ func (h *BufPane) FindNext() bool {
11001112
11011113// FindPrevious searches backwards for the last used search term
11021114func (h * BufPane ) FindPrevious () bool {
1115+ if h .Buf .LastSearch == "" {
1116+ return false
1117+ }
11031118 // If the cursor is at the end of a selection and we search we want
11041119 // to search from the beginning of the selection in the case that
11051120 // the selection is a search result in which case we wouldn't move at
Original file line number Diff line number Diff line change @@ -811,6 +811,7 @@ var BufKeyActions = map[string]BufKeyAction{
811811 "ToggleRuler" : (* BufPane ).ToggleRuler ,
812812 "ToggleHighlightSearch" : (* BufPane ).ToggleHighlightSearch ,
813813 "UnhighlightSearch" : (* BufPane ).UnhighlightSearch ,
814+ "ResetSearch" : (* BufPane ).ResetSearch ,
814815 "ClearStatus" : (* BufPane ).ClearStatus ,
815816 "ShellMode" : (* BufPane ).ShellMode ,
816817 "CommandMode" : (* BufPane ).CommandMode ,
Original file line number Diff line number Diff line change @@ -241,6 +241,7 @@ ToggleHelp
241241ToggleDiffGutter
242242ToggleRuler
243243JumpLine
244+ ResetSearch
244245ClearStatus
245246ShellMode
246247CommandMode
You can’t perform that action at this time.
0 commit comments