Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ type Options struct {
ListenAddr *listenAddress
Unsafe bool
ClearOnExit bool
KeepScreen bool
WalkerOpts walkerOpts
WalkerRoot []string
WalkerSkip []string
Expand Down Expand Up @@ -3277,6 +3278,8 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
opts.ClearOnExit = true
case "--no-clear":
opts.ClearOnExit = false
case "--no-clear-on-start":
opts.KeepScreen = true
case "--walker":
str, err := nextString("walker options required [file][,dir][,follow][,hidden]")
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions src/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
if tui.HasFullscreenRenderer() {
renderer = tui.NewFullscreenRenderer(opts.Theme, opts.Black, opts.Mouse)
} else {
renderer, err = tui.NewLightRenderer(opts.TtyDefault, ttyin, opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, opts.ClearOnExit,
renderer, err = tui.NewLightRenderer(opts.TtyDefault, ttyin, opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, opts.ClearOnExit, opts.KeepScreen,
true, func(h int) int { return h })
}
} else {
Expand All @@ -958,7 +958,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
effectiveMinHeight += borderLines(opts.BorderShape)
return min(termHeight, max(evaluateHeight(opts, termHeight), effectiveMinHeight))
}
renderer, err = tui.NewLightRenderer(opts.TtyDefault, ttyin, opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, opts.ClearOnExit, false, maxHeightFunc)
renderer, err = tui.NewLightRenderer(opts.TtyDefault, ttyin, opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, opts.ClearOnExit, opts.KeepScreen, false, maxHeightFunc)
}
if err != nil {
return nil, err
Expand Down
6 changes: 4 additions & 2 deletions src/tui/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ type LightRenderer struct {
mouse bool
forceBlack bool
clearOnExit bool
keepScreen bool
prevDownTime time.Time
clicks [][2]int
ttyin *os.File
Expand Down Expand Up @@ -146,7 +147,7 @@ type LightWindow struct {
wrapSignWidth int
}

func NewLightRenderer(ttyDefault string, ttyin *os.File, theme *ColorTheme, forceBlack bool, mouse bool, tabstop int, clearOnExit bool, fullscreen bool, maxHeightFunc func(int) int) (Renderer, error) {
func NewLightRenderer(ttyDefault string, ttyin *os.File, theme *ColorTheme, forceBlack bool, mouse bool, tabstop int, clearOnExit bool, keepScreen bool, fullscreen bool, maxHeightFunc func(int) int) (Renderer, error) {
out, err := openTtyOut(ttyDefault)
if err != nil {
out = os.Stderr
Expand All @@ -156,6 +157,7 @@ func NewLightRenderer(ttyDefault string, ttyin *os.File, theme *ColorTheme, forc
forceBlack: forceBlack,
mouse: mouse,
clearOnExit: clearOnExit,
keepScreen: keepScreen,
ttyin: ttyin,
ttyout: out,
yoffset: 0,
Expand Down Expand Up @@ -195,7 +197,7 @@ func (r *LightRenderer) Init() error {
} else {
// We assume that --no-clear is used for repetitive relaunching of fzf.
// So we do not clear the lower bottom of the screen.
if r.clearOnExit {
if r.clearOnExit && !r.keepScreen {
r.csi("J")
}
y, x := r.findOffset()
Expand Down
2 changes: 1 addition & 1 deletion src/tui/light_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func TestLightRenderer(t *testing.T) {
tty_file, _ := os.Open("")
renderer, _ := NewLightRenderer(
"", tty_file, &ColorTheme{}, true, false, 0, false, true,
"", tty_file, &ColorTheme{}, true, false, 0, false, false, true,
func(h int) int { return h })

light_renderer := renderer.(*LightRenderer)
Expand Down