m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-17 15:53:39 -05:00

(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
This commit is contained in:
Junegunn Choi
2023-10-26 00:22:28 +09:00
parent bac385b59c
commit d02b9442a5
10 changed files with 169 additions and 93 deletions

View File

@@ -203,9 +203,10 @@ func (r *FullscreenRenderer) Refresh() {
// noop
}
func (r *FullscreenRenderer) Size() (termSize, error) {
// TODO: Pixel width and height not implemented
func (r *FullscreenRenderer) Size() TermSize {
cols, lines := _screen.Size()
return termSize{lines, cols, 0, 0}, error("Not implemented")
return TermSize{lines, cols, 0, 0}
}
func (r *FullscreenRenderer) GetChar() Event {