summaryrefslogtreecommitdiff
path: root/src/options.go
diff options
context:
space:
mode:
authorAndreas Auernhammer <github@aead.dev>2025-01-04 10:30:32 +0100
committerGitHub <noreply@github.com>2025-01-04 18:30:32 +0900
commit120cd7f25a8209297f15b0a79b36c44b30e641fb (patch)
tree60e91ffcaeca4fcae11a2b2dc76b1533659493b2 /src/options.go
parentfb3bf6c9841d849ec459fc6b251b4aa0f16d8038 (diff)
downloadfzf-120cd7f25a8209297f15b0a79b36c44b30e641fb.tar.gz
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>
Diffstat (limited to 'src/options.go')
-rw-r--r--src/options.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/options.go b/src/options.go
index 0b6250f3..a3096d11 100644
--- a/src/options.go
+++ b/src/options.go
@@ -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":