Implemented 'ResetSearch' to allow a search to be resetted

Added ResetSearch to the list of bindable actions in keybindings.md
This commit is contained in:
Massimo Mund
2024-06-08 11:08:38 +02:00
parent f4d576b6e0
commit bbf6ec292e
3 changed files with 11 additions and 0 deletions

View File

@@ -1072,6 +1072,15 @@ func (h *BufPane) UnhighlightSearch() bool {
return true
}
// ResetSearch resets the last used search term
func (h *BufPane) ResetSearch() bool {
if h.Buf.LastSearch != "" {
h.Buf.LastSearch = ""
return true
}
return false
}
// FindNext searches forwards for the last used search term
func (h *BufPane) FindNext() bool {
if h.Buf.LastSearch == "" {

View File

@@ -815,6 +815,7 @@ var BufKeyActions = map[string]BufKeyAction{
"ToggleRuler": (*BufPane).ToggleRuler,
"ToggleHighlightSearch": (*BufPane).ToggleHighlightSearch,
"UnhighlightSearch": (*BufPane).UnhighlightSearch,
"ResetSearch": (*BufPane).ResetSearch,
"ClearStatus": (*BufPane).ClearStatus,
"ShellMode": (*BufPane).ShellMode,
"CommandMode": (*BufPane).CommandMode,

View File

@@ -241,6 +241,7 @@ ToggleHelp
ToggleDiffGutter
ToggleRuler
JumpLine
ResetSearch
ClearStatus
ShellMode
CommandMode