summaryrefslogtreecommitdiffstats
path: root/src/options.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-05-16 23:53:10 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-05-16 23:59:08 +0900
commit17a13f00f8f17ba32b3f5737fda7055af023b269 (patch)
tree31de164fcb30da2440433ccb8353ee7045fbf508 /src/options.go
parent43436e48e0dacb51f9ab3da84b4c1ec697b744da (diff)
Allow customizing scrollbar of the preview window via --scrollbar=xy
Diffstat (limited to 'src/options.go')
-rw-r--r--src/options.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/options.go b/src/options.go
index e50c1fcc..6e3040b3 100644
--- a/src/options.go
+++ b/src/options.go
@@ -75,7 +75,7 @@ const usage = `usage: fzf [options]
--info=STYLE Finder info style [default|hidden|inline|inline:SEPARATOR]
--separator=STR String to form horizontal separator on info line
--no-separator Hide info line separator
- --scrollbar[=CHAR] Scrollbar character
+ --scrollbar[=C1[C2]] Scrollbar character(s) (each for main and preview window)
--no-scrollbar Hide scrollbar
--prompt=STR Input prompt (default: '> ')
--pointer=STR Pointer to the current line (default: '>')
@@ -1960,8 +1960,16 @@ func postProcessOptions(opts *Options) {
errorExit("--height option is currently not supported on this platform")
}
- if opts.Scrollbar != nil && runewidth.StringWidth(*opts.Scrollbar) > 1 {
- errorExit("scrollbar display width should be 1")
+ if opts.Scrollbar != nil {
+ runes := []rune(*opts.Scrollbar)
+ if len(runes) > 2 {
+ errorExit("--scrollbar should be given one or two characters")
+ }
+ for _, r := range runes {
+ if runewidth.RuneWidth(r) != 1 {
+ errorExit("scrollbar display width should be 1")
+ }
+ }
}
// Default actions for CTRL-N / CTRL-P when --history is set