mirror of
https://github.com/junegunn/fzf.git
synced 2026-07-09 18:19:13 +08:00
Clear border text of the floating pane when no label is given
This commit is contained in:
+11
-6
@@ -120,15 +120,18 @@ func runTmuxFloatingPane(argStr string, dir string, windowWidth int, windowHeigh
|
||||
|
||||
// Set --border-label as the title of the floating pane, and as its
|
||||
// pane-border-format so that it is displayed on the border when
|
||||
// pane-border-status is enabled. pane-border-format is pane-scoped,
|
||||
// pane-border-status is enabled. Without a label, the border text
|
||||
// is cleared so that the default pane status content (e.g. the
|
||||
// pane title) is not shown. pane-border-format is pane-scoped,
|
||||
// but pane-border-status is a window option that only becomes
|
||||
// pane-scoped in the next release of tmux, so it is left alone.
|
||||
// https://github.com/tmux/tmux/commit/7a18fa281db3
|
||||
// --border-label-pos is ignored.
|
||||
// Skipped when fzf draws its own border with the label on it.
|
||||
// '--border=none' is included; fzf would not display the label, but
|
||||
// the native border of a floating pane cannot be removed, so
|
||||
// display the label on it nonetheless.
|
||||
// The label is left to fzf when it draws its own border with the
|
||||
// label on it. '--border=none' is not the case; fzf would not
|
||||
// display the label, but the native border of a floating pane
|
||||
// cannot be removed, so display the label on it nonetheless.
|
||||
format := ""
|
||||
if opts.BorderLabel.label != "" &&
|
||||
(opts.BorderShape == tui.BorderUndefined || opts.BorderShape == tui.BorderLine ||
|
||||
opts.BorderShape == tui.BorderNone) {
|
||||
@@ -139,9 +142,11 @@ func runTmuxFloatingPane(argStr string, dir string, windowWidth int, windowHeigh
|
||||
escapeSingleQuote(escapeTmuxTitle(label)))
|
||||
// The title is displayed verbatim; substituted values are
|
||||
// not expanded again
|
||||
setup += `tmux set-option -p -t "$TMUX_PANE" pane-border-format '#{pane_title}' 2> /dev/null; `
|
||||
format = "#{pane_title}"
|
||||
}
|
||||
}
|
||||
setup += fmt.Sprintf(`tmux set-option -p -t "$TMUX_PANE" pane-border-format %s 2> /dev/null; `,
|
||||
escapeSingleQuote(format))
|
||||
paneCmd := fmt.Sprintf("%s%s %s; echo $? > %s; tmux wait-for -S %s",
|
||||
setup, escapeSingleQuote(sh), escapeSingleQuote(temp), code, signal)
|
||||
// Unzoom the window first; creating a floating pane over a zoomed
|
||||
|
||||
@@ -17,6 +17,9 @@ class TestTmux < TestInteractive
|
||||
def test_floating_pane
|
||||
tmux.send_keys "seq 100 | #{fzf('--popup center,80% --margin 0')}", :Enter
|
||||
tmux.until { |lines| assert_equal 100, lines.item_count }
|
||||
# Border text is cleared when no label is given
|
||||
format = IO.popen(['tmux', 'show-options', '-p', '-t', floating_pane, 'pane-border-format'], &:read)
|
||||
assert_includes format, "''"
|
||||
tmux.send_keys '99'
|
||||
tmux.until { |lines| assert_equal 1, lines.match_count }
|
||||
tmux.send_keys :Enter
|
||||
|
||||
Reference in New Issue
Block a user