Skip to content

Commit

Permalink
Implemented 'ResetSearch' to allow a search to be resetted
Browse files Browse the repository at this point in the history
  • Loading branch information
masmu committed Jun 8, 2024
1 parent f4d576b commit 30cb84b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/action/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down
1 change: 1 addition & 0 deletions internal/action/bufpane.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 30cb84b

Please sign in to comment.