Skip to content

Commit

Permalink
Add actions: show-header and hide-header
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Dec 31, 2023
1 parent 863a125 commit d210660
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ CHANGELOG
```sh
export FZF_CTRL_R_OPTS='--bind "enter:become:if [[ -n {} ]]; then echo {}; else echo {q}; fi"'
```
- Added `show-header` and `hide-header` actions
- Bug fixes

0.44.1
Expand Down
2 changes: 2 additions & 0 deletions man/man1/fzf.1
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,7 @@ A key or an event can be bound to one or more of the following actions.
\fBpage-up\fR \fIpgup\fR
\fBhalf-page-down\fR
\fBhalf-page-up\fR
\fBhide-header\fR
\fBhide-preview\fR
\fBoffset-down\fR (similar to CTRL-E of Vim)
\fBoffset-up\fR (similar to CTRL-Y of Vim)
Expand All @@ -1208,6 +1209,7 @@ A key or an event can be bound to one or more of the following actions.
\fBreplace-query\fR (replace query string with the current selection)
\fBselect\fR
\fBselect-all\fR (select all matches)
\fBshow-header\fR
\fBshow-preview\fR
\fBtoggle\fR (\fIright-click\fR)
\fBtoggle-all\fR (toggle all matches)
Expand Down
6 changes: 4 additions & 2 deletions src/actiontype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,10 @@ func parseActionList(masked string, original string, prevActions []*action, putA
appendAction(actToggleTrack)
case "toggle-header":
appendAction(actToggleHeader)
case "show-header":
appendAction(actShowHeader)
case "hide-header":
appendAction(actHideHeader)
case "track":
appendAction(actTrack)
case "select":
Expand Down
8 changes: 8 additions & 0 deletions src/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ const (
actRebind
actBecome
actResponse
actShowHeader
actHideHeader
)

func processExecution(action actionType) bool {
Expand Down Expand Up @@ -3715,6 +3717,12 @@ func (t *Terminal) Loop() {
t.track = trackEnabled
}
req(reqInfo)
case actShowHeader:
t.headerVisible = true
req(reqList, reqInfo, reqPrompt, reqHeader)
case actHideHeader:
t.headerVisible = false
req(reqList, reqInfo, reqPrompt, reqHeader)
case actToggleHeader:
t.headerVisible = !t.headerVisible
req(reqList, reqInfo, reqPrompt, reqHeader)
Expand Down

0 comments on commit d210660

Please sign in to comment.