From 6c0ca4a64a4e2f8697dfa830dcae56c1d7ddca51 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 30 Jan 2025 00:50:46 +0900 Subject: Add --no-input to hide the input section (#4210) Close #2890 Close #1396 You can't type in queries in this mode, and the only way to trigger an fzf search is to use `search(...)` action. # Click header to trigger search fzf --header '[src] [test]' --no-input --layout reverse \ --header-border bottom --input-border \ --bind 'click-header:transform-search:echo ${FZF_CLICK_HEADER_WORD:1:-1}' --- src/tui/light.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/tui/light.go') diff --git a/src/tui/light.go b/src/tui/light.go index 54c38c18..7b40efbb 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -77,7 +77,13 @@ func (r *LightRenderer) csi(code string) string { func (r *LightRenderer) flush() { if r.queued.Len() > 0 { - r.flushRaw("\x1b[?7l\x1b[?25l" + r.queued.String() + "\x1b[?25h\x1b[?7h") + raw := "\x1b[?7l\x1b[?25l" + r.queued.String() + if r.showCursor { + raw += "\x1b[?25h\x1b[?7h" + } else { + raw += "\x1b[?7h" + } + r.flushRaw(raw) r.queued.Reset() } } @@ -110,6 +116,7 @@ type LightRenderer struct { y int x int maxHeightFunc func(int) int + showCursor bool // Windows only ttyinChannel chan byte @@ -152,7 +159,8 @@ func NewLightRenderer(ttyin *os.File, theme *ColorTheme, forceBlack bool, mouse tabstop: tabstop, fullscreen: fullscreen, upOneLine: false, - maxHeightFunc: maxHeightFunc} + maxHeightFunc: maxHeightFunc, + showCursor: true} return &r, nil } @@ -759,6 +767,9 @@ func (r *LightRenderer) Close() { } else if !r.fullscreen { r.csi("u") } + if !r.showCursor { + r.csi("?25h") + } r.disableMouse() r.flush() r.closePlatform() @@ -1214,3 +1225,7 @@ func (w *LightWindow) Erase() { func (w *LightWindow) EraseMaybe() bool { return false } + +func (r *LightRenderer) HideCursor() { + r.showCursor = false +} -- cgit v1.2.3