summaryrefslogtreecommitdiff
path: root/src/tui/tcell.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-30 00:50:46 +0900
committerGitHub <noreply@github.com>2025-01-30 00:50:46 +0900
commit6c0ca4a64a4e2f8697dfa830dcae56c1d7ddca51 (patch)
treeb3cb6eefec8009c815d0ce0a4bea3032f8bc0cf8 /src/tui/tcell.go
parent6b5d4614114f1a7a34a50c21ed2952f94a5ee81e (diff)
downloadfzf-6c0ca4a64a4e2f8697dfa830dcae56c1d7ddca51.tar.gz
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}'
Diffstat (limited to 'src/tui/tcell.go')
-rw-r--r--src/tui/tcell.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/tui/tcell.go b/src/tui/tcell.go
index 3738214a..9d6fde80 100644
--- a/src/tui/tcell.go
+++ b/src/tui/tcell.go
@@ -52,6 +52,7 @@ type TcellWindow struct {
borderStyle BorderStyle
uri *string
params *string
+ showCursor bool
}
func (w *TcellWindow) Top() int {
@@ -72,7 +73,9 @@ func (w *TcellWindow) Height() int {
func (w *TcellWindow) Refresh() {
if w.moveCursor {
- _screen.ShowCursor(w.left+w.lastX, w.top+w.lastY)
+ if w.showCursor {
+ _screen.ShowCursor(w.left+w.lastX, w.top+w.lastY)
+ }
w.moveCursor = false
}
w.lastX = 0
@@ -104,6 +107,10 @@ func (r *FullscreenRenderer) Bell() {
_screen.Beep()
}
+func (r *FullscreenRenderer) HideCursor() {
+ r.showCursor = false
+}
+
func (r *FullscreenRenderer) PassThrough(str string) {
// No-op
// https://github.com/gdamore/tcell/pull/650#issuecomment-1806442846
@@ -168,6 +175,9 @@ func (r *FullscreenRenderer) getScreen() (tcell.Screen, error) {
if e != nil {
return nil, e
}
+ if !r.showCursor {
+ s.HideCursor()
+ }
_screen = s
}
return _screen, nil
@@ -590,7 +600,8 @@ func (r *FullscreenRenderer) NewWindow(top int, left int, width int, height int,
width: width,
height: height,
normal: normal,
- borderStyle: borderStyle}
+ borderStyle: borderStyle,
+ showCursor: r.showCursor}
w.Erase()
return w
}