mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-02-08 15:08:30 +00:00
Add 'bell' action to ring the terminal bell
This commit is contained in:
parent
02199cd609
commit
04017c25bb
@ -9,10 +9,16 @@ CHANGELOG
|
|||||||
- fzf will automatically choose `path` scheme when the input is a TTY device, where fzf would start its built-in walker or run `$FZF_DEFAULT_COMMAND` which is usually a command for listing files.
|
- fzf will automatically choose `path` scheme when the input is a TTY device, where fzf would start its built-in walker or run `$FZF_DEFAULT_COMMAND` which is usually a command for listing files.
|
||||||
- Added `--header-lines-border` to display header from `--header-lines` with a separate border
|
- Added `--header-lines-border` to display header from `--header-lines` with a separate border
|
||||||
```sh
|
```sh
|
||||||
|
# Use --header-lines-border to separate two headers
|
||||||
ps -ef | fzf --style full --layout reverse --header-lines 1 \
|
ps -ef | fzf --style full --layout reverse --header-lines 1 \
|
||||||
--bind 'ctrl-r:reload(ps -ef)' --header 'Press CTRL-R to reload' \
|
--bind 'ctrl-r:reload(ps -ef)' --header 'Press CTRL-R to reload' \
|
||||||
--header-lines-border bottom --no-list-border
|
--header-lines-border bottom --no-list-border
|
||||||
```
|
```
|
||||||
|
- Added `bell` action to ring the terminal bell
|
||||||
|
```sh
|
||||||
|
# Press CTRL-Y to copy the current line to the clipboard and ring the bell
|
||||||
|
fzf --bind 'ctrl-y:execute-silent(echo -n {} | pbcopy)+bell'
|
||||||
|
```
|
||||||
- Bug fixes and improvements
|
- Bug fixes and improvements
|
||||||
- Fixed fish script to support fish 3.1.2 or later (@bitraid)
|
- Fixed fish script to support fish 3.1.2 or later (@bitraid)
|
||||||
|
|
||||||
|
@ -1541,6 +1541,7 @@ A key or an event can be bound to one or more of the following actions.
|
|||||||
\fBbackward\-word\fR \fIalt\-b shift\-left\fR
|
\fBbackward\-word\fR \fIalt\-b shift\-left\fR
|
||||||
\fBbecome(...)\fR (replace fzf process with the specified command; see below for the details)
|
\fBbecome(...)\fR (replace fzf process with the specified command; see below for the details)
|
||||||
\fBbeginning\-of\-line\fR \fIctrl\-a home\fR
|
\fBbeginning\-of\-line\fR \fIctrl\-a home\fR
|
||||||
|
\fBbell\fR (ring the terminal bell)
|
||||||
\fBcancel\fR (clear query string if not empty, abort fzf otherwise)
|
\fBcancel\fR (clear query string if not empty, abort fzf otherwise)
|
||||||
\fBchange\-border\-label(...)\fR (change \fB\-\-border\-label\fR to the given string)
|
\fBchange\-border\-label(...)\fR (change \fB\-\-border\-label\fR to the given string)
|
||||||
\fBchange\-header(...)\fR (change header to the given string; doesn't affect \fB\-\-header\-lines\fR)
|
\fBchange\-header(...)\fR (change header to the given string; doesn't affect \fB\-\-header\-lines\fR)
|
||||||
|
@ -1586,6 +1586,8 @@ func parseActionList(masked string, original string, prevActions []*action, putA
|
|||||||
} else {
|
} else {
|
||||||
return nil, errors.New("unable to put non-printable character")
|
return nil, errors.New("unable to put non-printable character")
|
||||||
}
|
}
|
||||||
|
case "bell":
|
||||||
|
appendAction(actBell)
|
||||||
default:
|
default:
|
||||||
t := isExecuteAction(specLower)
|
t := isExecuteAction(specLower)
|
||||||
if t == actIgnore {
|
if t == actIgnore {
|
||||||
|
@ -567,6 +567,7 @@ const (
|
|||||||
actBecome
|
actBecome
|
||||||
actShowHeader
|
actShowHeader
|
||||||
actHideHeader
|
actHideHeader
|
||||||
|
actBell
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a actionType) Name() string {
|
func (a actionType) Name() string {
|
||||||
@ -4704,6 +4705,8 @@ func (t *Terminal) Loop() error {
|
|||||||
t.executor.Become(t.ttyin, t.environ(), command)
|
t.executor.Become(t.ttyin, t.environ(), command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case actBell:
|
||||||
|
t.tui.Bell()
|
||||||
case actExecute, actExecuteSilent:
|
case actExecute, actExecuteSilent:
|
||||||
t.executeCommand(a.a, false, a.t == actExecuteSilent, false, false, "")
|
t.executeCommand(a.a, false, a.t == actExecuteSilent, false, false, "")
|
||||||
case actExecuteMulti:
|
case actExecuteMulti:
|
||||||
|
@ -44,6 +44,7 @@ func (r *FullscreenRenderer) PassThrough(string) {}
|
|||||||
func (r *FullscreenRenderer) Clear() {}
|
func (r *FullscreenRenderer) Clear() {}
|
||||||
func (r *FullscreenRenderer) NeedScrollbarRedraw() bool { return false }
|
func (r *FullscreenRenderer) NeedScrollbarRedraw() bool { return false }
|
||||||
func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool { return false }
|
func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool { return false }
|
||||||
|
func (r *FullscreenRenderer) Bell() {}
|
||||||
func (r *FullscreenRenderer) Refresh() {}
|
func (r *FullscreenRenderer) Refresh() {}
|
||||||
func (r *FullscreenRenderer) Close() {}
|
func (r *FullscreenRenderer) Close() {}
|
||||||
func (r *FullscreenRenderer) Size() TermSize { return TermSize{} }
|
func (r *FullscreenRenderer) Size() TermSize { return TermSize{} }
|
||||||
|
@ -32,6 +32,10 @@ const consoleDevice string = "/dev/tty"
|
|||||||
var offsetRegexp = regexp.MustCompile("(.*)\x1b\\[([0-9]+);([0-9]+)R")
|
var offsetRegexp = regexp.MustCompile("(.*)\x1b\\[([0-9]+);([0-9]+)R")
|
||||||
var offsetRegexpBegin = regexp.MustCompile("^\x1b\\[[0-9]+;[0-9]+R")
|
var offsetRegexpBegin = regexp.MustCompile("^\x1b\\[[0-9]+;[0-9]+R")
|
||||||
|
|
||||||
|
func (r *LightRenderer) Bell() {
|
||||||
|
r.flushRaw("\a")
|
||||||
|
}
|
||||||
|
|
||||||
func (r *LightRenderer) PassThrough(str string) {
|
func (r *LightRenderer) PassThrough(str string) {
|
||||||
r.queued.WriteString("\x1b7" + str + "\x1b8")
|
r.queued.WriteString("\x1b7" + str + "\x1b8")
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,10 @@ const (
|
|||||||
BoldForce = Attr(1 << 10)
|
BoldForce = Attr(1 << 10)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (r *FullscreenRenderer) Bell() {
|
||||||
|
_screen.Beep()
|
||||||
|
}
|
||||||
|
|
||||||
func (r *FullscreenRenderer) PassThrough(str string) {
|
func (r *FullscreenRenderer) PassThrough(str string) {
|
||||||
// No-op
|
// No-op
|
||||||
// https://github.com/gdamore/tcell/pull/650#issuecomment-1806442846
|
// https://github.com/gdamore/tcell/pull/650#issuecomment-1806442846
|
||||||
|
@ -580,6 +580,7 @@ type Renderer interface {
|
|||||||
PassThrough(string)
|
PassThrough(string)
|
||||||
NeedScrollbarRedraw() bool
|
NeedScrollbarRedraw() bool
|
||||||
ShouldEmitResizeEvent() bool
|
ShouldEmitResizeEvent() bool
|
||||||
|
Bell()
|
||||||
|
|
||||||
GetChar() Event
|
GetChar() Event
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user