Add --no-clear option
This commit is contained in:
parent
337cdbb37c
commit
53348feb89
@ -339,6 +339,12 @@ Read input delimited by ASCII NUL characters instead of newline characters
|
|||||||
.B "--print0"
|
.B "--print0"
|
||||||
Print output delimited by ASCII NUL characters instead of newline characters
|
Print output delimited by ASCII NUL characters instead of newline characters
|
||||||
.TP
|
.TP
|
||||||
|
.B "--no-clear"
|
||||||
|
Do not clear finder interface on exit. If fzf was started in full screen mode,
|
||||||
|
it will not switch back to the original screen, so you'll have to manually run
|
||||||
|
\fBtput rmcup\fR to return. This option can be used to avoid flickering of the
|
||||||
|
screen when your application needs to start fzf multiple times in order.
|
||||||
|
.TP
|
||||||
.B "--sync"
|
.B "--sync"
|
||||||
Synchronous search for multi-staged filtering. If specified, fzf will launch
|
Synchronous search for multi-staged filtering. If specified, fzf will launch
|
||||||
ncurses finder only after the input stream is complete.
|
ncurses finder only after the input stream is complete.
|
||||||
|
@ -186,6 +186,7 @@ type Options struct {
|
|||||||
Margin [4]sizeSpec
|
Margin [4]sizeSpec
|
||||||
Bordered bool
|
Bordered bool
|
||||||
Tabstop int
|
Tabstop int
|
||||||
|
ClearOnExit bool
|
||||||
Version bool
|
Version bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +235,7 @@ func defaultOptions() *Options {
|
|||||||
HeaderLines: 0,
|
HeaderLines: 0,
|
||||||
Margin: defaultMargin(),
|
Margin: defaultMargin(),
|
||||||
Tabstop: 8,
|
Tabstop: 8,
|
||||||
|
ClearOnExit: true,
|
||||||
Version: false}
|
Version: false}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1099,6 +1101,10 @@ func parseOptions(opts *Options, allArgs []string) {
|
|||||||
nextString(allArgs, &i, "margin required (TRBL / TB,RL / T,RL,B / T,R,B,L)"))
|
nextString(allArgs, &i, "margin required (TRBL / TB,RL / T,RL,B / T,R,B,L)"))
|
||||||
case "--tabstop":
|
case "--tabstop":
|
||||||
opts.Tabstop = nextInt(allArgs, &i, "tab stop required")
|
opts.Tabstop = nextInt(allArgs, &i, "tab stop required")
|
||||||
|
case "--clear":
|
||||||
|
opts.ClearOnExit = true
|
||||||
|
case "--no-clear":
|
||||||
|
opts.ClearOnExit = false
|
||||||
case "--version":
|
case "--version":
|
||||||
opts.Version = true
|
opts.Version = true
|
||||||
default:
|
default:
|
||||||
|
@ -316,11 +316,11 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
|||||||
}
|
}
|
||||||
return util.Min(termHeight, util.Max(maxHeight, effectiveMinHeight))
|
return util.Min(termHeight, util.Max(maxHeight, effectiveMinHeight))
|
||||||
}
|
}
|
||||||
renderer = tui.NewLightRenderer(opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, maxHeightFunc)
|
renderer = tui.NewLightRenderer(opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, opts.ClearOnExit, maxHeightFunc)
|
||||||
} else if tui.HasFullscreenRenderer() {
|
} else if tui.HasFullscreenRenderer() {
|
||||||
renderer = tui.NewFullscreenRenderer(opts.Theme, opts.Black, opts.Mouse)
|
renderer = tui.NewFullscreenRenderer(opts.Theme, opts.Black, opts.Mouse)
|
||||||
} else {
|
} else {
|
||||||
renderer = tui.NewLightRenderer(opts.Theme, opts.Black, opts.Mouse, opts.Tabstop,
|
renderer = tui.NewLightRenderer(opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, opts.ClearOnExit,
|
||||||
func(h int) int { return h })
|
func(h int) int { return h })
|
||||||
}
|
}
|
||||||
wordRubout := "[^[:alnum:]][[:alnum:]]"
|
wordRubout := "[^[:alnum:]][[:alnum:]]"
|
||||||
|
@ -74,6 +74,7 @@ type LightRenderer struct {
|
|||||||
theme *ColorTheme
|
theme *ColorTheme
|
||||||
mouse bool
|
mouse bool
|
||||||
forceBlack bool
|
forceBlack bool
|
||||||
|
clearOnExit bool
|
||||||
prevDownTime time.Time
|
prevDownTime time.Time
|
||||||
clickY []int
|
clickY []int
|
||||||
ttyin *os.File
|
ttyin *os.File
|
||||||
@ -106,11 +107,12 @@ type LightWindow struct {
|
|||||||
bg Color
|
bg Color
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLightRenderer(theme *ColorTheme, forceBlack bool, mouse bool, tabstop int, maxHeightFunc func(int) int) Renderer {
|
func NewLightRenderer(theme *ColorTheme, forceBlack bool, mouse bool, tabstop int, clearOnExit bool, maxHeightFunc func(int) int) Renderer {
|
||||||
r := LightRenderer{
|
r := LightRenderer{
|
||||||
theme: theme,
|
theme: theme,
|
||||||
forceBlack: forceBlack,
|
forceBlack: forceBlack,
|
||||||
mouse: mouse,
|
mouse: mouse,
|
||||||
|
clearOnExit: clearOnExit,
|
||||||
ttyin: openTtyIn(),
|
ttyin: openTtyIn(),
|
||||||
yoffset: 0,
|
yoffset: 0,
|
||||||
tabstop: tabstop,
|
tabstop: tabstop,
|
||||||
@ -571,14 +573,20 @@ func (r *LightRenderer) Refresh() {
|
|||||||
|
|
||||||
func (r *LightRenderer) Close() {
|
func (r *LightRenderer) Close() {
|
||||||
// r.csi("u")
|
// r.csi("u")
|
||||||
if r.fullscreen {
|
if r.clearOnExit {
|
||||||
r.rmcup()
|
if r.fullscreen {
|
||||||
} else {
|
r.rmcup()
|
||||||
r.origin()
|
} else {
|
||||||
if r.upOneLine {
|
r.origin()
|
||||||
r.csi("A")
|
if r.upOneLine {
|
||||||
|
r.csi("A")
|
||||||
|
}
|
||||||
|
r.csi("J")
|
||||||
}
|
}
|
||||||
r.csi("J")
|
} else if r.fullscreen {
|
||||||
|
r.csi("G")
|
||||||
|
} else {
|
||||||
|
r.move(r.height, 0)
|
||||||
}
|
}
|
||||||
if r.mouse {
|
if r.mouse {
|
||||||
r.csi("?1000l")
|
r.csi("?1000l")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user