mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-04 14:12:11 -07:00
Add border-native
option to --tmux
flag (#4157)
This commit adds the `border-native` resulting in the following: ``` --tmux[=[center|top|bottom|left|right][,SIZE[%]][,SIZE[%]][,border-native]] ``` By default, when not specified, the `-B` flag is passed to the `tmux popup-window` command such that no border is drawn around the tmux popup window. When the `border-native` option is present, the `-B` flag is omitted and the popup window is drawn using the border style configured in the tmux config file. Fixes #4156 Signed-off-by: Andreas Auernhammer <github@aead.dev> Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
This commit is contained in:
committed by
GitHub
parent
fb3bf6c984
commit
120cd7f25a
@@ -77,7 +77,7 @@ Usage: fzf [options]
|
||||
(default: 10)
|
||||
--tmux[=OPTS] Start fzf in a tmux popup (requires tmux 3.3+)
|
||||
[center|top|bottom|left|right][,SIZE[%]][,SIZE[%]]
|
||||
(default: center,50%)
|
||||
[,border-native] (default: center,50%)
|
||||
--layout=LAYOUT Choose layout: [default|reverse|reverse-list]
|
||||
--border[=STYLE] Draw border around the finder
|
||||
[rounded|sharp|bold|block|thinblock|double|horizontal|vertical|
|
||||
@@ -254,6 +254,7 @@ type tmuxOptions struct {
|
||||
height sizeSpec
|
||||
position windowPosition
|
||||
index int
|
||||
border bool
|
||||
}
|
||||
|
||||
type layoutType int
|
||||
@@ -316,11 +317,19 @@ func parseTmuxOptions(arg string, index int) (*tmuxOptions, error) {
|
||||
var err error
|
||||
opts := defaultTmuxOptions(index)
|
||||
tokens := splitRegexp.Split(arg, -1)
|
||||
errorToReturn := errors.New("invalid tmux option: " + arg + " (expected: [center|top|bottom|left|right][,SIZE[%]][,SIZE[%]])")
|
||||
if len(tokens) == 0 || len(tokens) > 3 {
|
||||
errorToReturn := errors.New("invalid tmux option: " + arg + " (expected: [center|top|bottom|left|right][,SIZE[%]][,SIZE[%][,border-native]])")
|
||||
if len(tokens) == 0 || len(tokens) > 4 {
|
||||
return nil, errorToReturn
|
||||
}
|
||||
|
||||
for i, token := range tokens {
|
||||
if token == "border-native" {
|
||||
tokens = append(tokens[:i], tokens[i+1:]...) // cut the 'border-native' option
|
||||
opts.border = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Defaults to 'center'
|
||||
switch tokens[0] {
|
||||
case "top", "up":
|
||||
|
Reference in New Issue
Block a user