Skip to content
Myr

Clear border text of the floating pane when no label is given

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 77e6394 · Browse files · 2 files+14 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−6 removed

  • tests:+3 added−0 removed
  • other:+11 added−6 removed

2 files+14 added−6 removed

modified:src/tmux.go+11 added-6 removed
118 unmodified lines
119 setup := `tmux set-option -p -t "$TMUX_PANE" remain-on-exit off 2> /dev/null; `120121 // Set --border-label as the title of the floating pane, and as its122 // pane-border-format so that it is displayed on the border when123 // pane-border-status is enabled. pane-border-format is pane-scoped,123 // pane-border-status is enabled. Without a label, the border text124 // is cleared so that the default pane status content (e.g. the125 // pane title) is not shown. pane-border-format is pane-scoped,126 // but pane-border-status is a window option that only becomes127 // pane-scoped in the next release of tmux, so it is left alone.128 // https://github.com/tmux/tmux/commit/7a18fa281db3129 // --border-label-pos is ignored.128 // Skipped when fzf draws its own border with the label on it.129 // '--border=none' is included; fzf would not display the label, but130 // the native border of a floating pane cannot be removed, so131 // display the label on it nonetheless.130 // The label is left to fzf when it draws its own border with the131 // label on it. '--border=none' is not the case; fzf would not132 // display the label, but the native border of a floating pane133 // cannot be removed, so display the label on it nonetheless.134 format := ""135 if opts.BorderLabel.label != "" &&136 (opts.BorderShape == tui.BorderUndefined || opts.BorderShape == tui.BorderLine ||137 opts.BorderShape == tui.BorderNone) {138 // Strip ANSI sequences fzf would otherwise render itself
2 unmodified lines
141 setup += fmt.Sprintf(`tmux select-pane -t "$TMUX_PANE" -T %s 2> /dev/null; `,142 escapeSingleQuote(escapeTmuxTitle(label)))143 // The title is displayed verbatim; substituted values are144 // not expanded again142 setup += `tmux set-option -p -t "$TMUX_PANE" pane-border-format '#{pane_title}' 2> /dev/null; `145 format = "#{pane_title}"146 }147 }148 setup += fmt.Sprintf(`tmux set-option -p -t "$TMUX_PANE" pane-border-format %s 2> /dev/null; `,149 escapeSingleQuote(format))150 paneCmd := fmt.Sprintf("%s%s %s; echo $? > %s; tmux wait-for -S %s",151 setup, escapeSingleQuote(sh), escapeSingleQuote(temp), code, signal)152 // Unzoom the window first; creating a floating pane over a zoomed153 // window crashes the tmux server on 3.7b, and newer versions of
87 unmodified lines
modified:test/test_tmux.rb+3 added
15 unmodified lines
1617 def test_floating_pane18 tmux.send_keys "seq 100 | #{fzf('--popup center,80% --margin 0')}", :Enter19 tmux.until { |lines| assert_equal 100, lines.item_count }20 # Border text is cleared when no label is given21 format = IO.popen(['tmux', 'show-options', '-p', '-t', floating_pane, 'pane-border-format'], &:read)22 assert_includes format, "''"23 tmux.send_keys '99'24 tmux.until { |lines| assert_equal 1, lines.match_count }25 tmux.send_keys :Enter26 assert_equal '99', fzf_output
54 unmodified lines