diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2023-10-26 00:22:28 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-10-26 00:49:16 +0900 |
commit | d02b9442a56ec03dbb905d432762cf545603ef07 (patch) | |
tree | fdf5878111abb8693a559fff355e499c49378782 /src/options.go | |
parent | bac385b59ccef279400689d406bf270cfdee06f3 (diff) |
(Experimental) Improve Sixel graphics support (#2544)
Progress:
* Sixel image can now be displayed with other text, and is scrollable
* If an image can't be displayed entirely due to the scroll offset, fzf
will render a wireframe to indicate that an image should be displayed
* Renamed $FZF_PREVIEW_{WIDTH,HEIGHT} to $FZF_PREVIEW_PIXEL_{WIDTH,HEIGHT}
for clarity
* Added bin/fzf-preview.sh script to demonstrate how to display an image
using Kitty or Sixel protocol
An example:
ls *.jpg | fzf --preview='seq $((FZF_PREVIEW_LINES*9/10)); fzf-preview.sh {}; seq 100'
A known issue:
* If you reduce the size of the preview window, the image may extend
beyond the preview window
Diffstat (limited to 'src/options.go')
-rw-r--r-- | src/options.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/options.go b/src/options.go index 83258820..b4f74e95 100644 --- a/src/options.go +++ b/src/options.go @@ -219,7 +219,6 @@ type previewOpts struct { scroll string hidden bool wrap bool - clear bool cycle bool follow bool border tui.BorderShape @@ -341,7 +340,7 @@ type Options struct { } func defaultPreviewOpts(command string) previewOpts { - return previewOpts{command, posRight, sizeSpec{50, true}, "", false, false, false, false, false, tui.DefaultBorderShape, 0, 0, nil} + return previewOpts{command, posRight, sizeSpec{50, true}, "", false, false, false, false, tui.DefaultBorderShape, 0, 0, nil} } func defaultOptions() *Options { @@ -1455,10 +1454,6 @@ func parsePreviewWindowImpl(opts *previewOpts, input string, exit func(string)) opts.wrap = true case "nowrap": opts.wrap = false - case "clear": - opts.clear = true - case "noclear": - opts.clear = false case "cycle": opts.cycle = true case "nocycle": @@ -1793,7 +1788,7 @@ func parseOptions(opts *Options, allArgs []string) { opts.Preview.command = "" case "--preview-window": parsePreviewWindow(&opts.Preview, - nextString(allArgs, &i, "preview window layout required: [up|down|left|right][,SIZE[%]][,border-BORDER_OPT][,wrap][,clear][,cycle][,hidden][,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES][,default]")) + nextString(allArgs, &i, "preview window layout required: [up|down|left|right][,SIZE[%]][,border-BORDER_OPT][,wrap][,cycle][,hidden][,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES][,default]")) case "--height": opts.Height = parseHeight(nextString(allArgs, &i, "height required: [~]HEIGHT[%]")) case "--min-height": |