Add 'bell' action to ring the terminal bell
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent 02199cd · Browse files · 8 files·+22 added−0 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
8 files+22 added−0 removed
- other:+22 added−0 removed
Provenance
- Commit
04017c2- Tree
a531b44- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
02199cd
8 files changed+22 added−0 removed
modified:man/man1/fzf.1+1 added
1539 unmodified lines1540 \fBbackward\-kill\-word\fR \fIalt\-bs\fR1541 \fBbackward\-word\fR \fIalt\-b shift\-left\fR1542 \fBbecome(...)\fR (replace fzf process with the specified command; see below for the details)1543 \fBbeginning\-of\-line\fR \fIctrl\-a home\fR1544+ \fBbell\fR (ring the terminal bell)1545 \fBcancel\fR (clear query string if not empty, abort fzf otherwise)1546 \fBchange\-border\-label(...)\fR (change \fB\-\-border\-label\fR to the given string)1547 \fBchange\-header(...)\fR (change header to the given string; doesn't affect \fB\-\-header\-lines\fR)1548 \fBchange\-header\-label(...)\fR (change \fB\-\-header\-label\fR to the given string)272 unmodified linesmodified:src/tui/dummy.go+1 added
42 unmodified lines43 func (r *FullscreenRenderer) PassThrough(string) {}44 func (r *FullscreenRenderer) Clear() {}45 func (r *FullscreenRenderer) NeedScrollbarRedraw() bool { return false }46 func (r *FullscreenRenderer) ShouldEmitResizeEvent() bool { return false }47+func (r *FullscreenRenderer) Bell() {}48 func (r *FullscreenRenderer) Refresh() {}49 func (r *FullscreenRenderer) Close() {}50 func (r *FullscreenRenderer) Size() TermSize { return TermSize{} }51 10 unmodified linesmodified:src/tui/light.go+4 added
30 unmodified lines31 32 var offsetRegexp = regexp.MustCompile("(.*)\x1b\\[([0-9]+);([0-9]+)R")33 var offsetRegexpBegin = regexp.MustCompile("^\x1b\\[[0-9]+;[0-9]+R")34 35+func (r *LightRenderer) Bell() {36+ r.flushRaw("\a")37+}38+39 func (r *LightRenderer) PassThrough(str string) {40 r.queued.WriteString("\x1b7" + str + "\x1b8")41 }42 1176 unmodified linesmodified:src/tui/tcell.go+4 added
98 unmodified lines99 AttrClear = Attr(1 << 8)100 BoldForce = Attr(1 << 10)101 )102 103+func (r *FullscreenRenderer) Bell() {104+ _screen.Beep()105+}106+107 func (r *FullscreenRenderer) PassThrough(str string) {108 // No-op109 // https://github.com/gdamore/tcell/pull/650#issuecomment-1806442846110 }763 unmodified linesmodified:src/tui/tui.go+1 added
578 unmodified lines579 Close()580 PassThrough(string)581 NeedScrollbarRedraw() bool582 ShouldEmitResizeEvent() bool583+ Bell()584 585 GetChar() Event586 587 Top() int449 unmodified linesmodified:src/options.go+2 added
1584 unmodified lines1585 appendAction(actChar)1586 } else {1587 return nil, errors.New("unable to put non-printable character")1588 }1589+ case "bell":1590+ appendAction(actBell)1591 default:1592 t := isExecuteAction(specLower)1593 if t == actIgnore {1594 if specIndex == 0 && specLower == "" {1701 unmodified linesmodified:src/terminal.go+3 added
565 unmodified lines566 actRebind567 actBecome568 actShowHeader569 actHideHeader570+ actBell571 )572 573 func (a actionType) Name() string {574 return util.ToKebabCase(a.String()[3:])4129 unmodified lines4704 } else {4705 t.executor.Become(t.ttyin, t.environ(), command)4706 }4707 }4708+ case actBell:4709+ t.tui.Bell()4710 case actExecute, actExecuteSilent:4711 t.executeCommand(a.a, false, a.t == actExecuteSilent, false, false, "")4712 case actExecuteMulti:4713 t.executeCommand(a.a, true, false, false, false, "")1286 unmodified linesmodified:CHANGELOG.md+6 added
7 unmodified lines8 - `--scheme=path` now sets `--tiebreak=pathname,length`9 - 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.10 - Added `--header-lines-border` to display header from `--header-lines` with a separate border11 ```sh12+ # Use --header-lines-border to separate two headers13 ps -ef | fzf --style full --layout reverse --header-lines 1 \14 --bind 'ctrl-r:reload(ps -ef)' --header 'Press CTRL-R to reload' \15 --header-lines-border bottom --no-list-border16 ```17+- Added `bell` action to ring the terminal bell18+ ```sh19+ # Press CTRL-Y to copy the current line to the clipboard and ring the bell20+ fzf --bind 'ctrl-y:execute-silent(echo -n {} | pbcopy)+bell'21+ ```22 - Bug fixes and improvements23 - Fixed fish script to support fish 3.1.2 or later (@bitraid)24 25 0.58.02430 unmodified lines