Experimental Sixel support (#2544)

This commit is contained in:
Junegunn Choi
2023-10-23 01:01:47 +09:00
parent a33749eb71
commit b1a0ab8086
9 changed files with 117 additions and 11 deletions

View File

@@ -8,6 +8,7 @@ import (
"os/exec"
"strings"
"syscall"
"unsafe"
"github.com/junegunn/fzf/src/util"
"golang.org/x/term"
@@ -108,3 +109,19 @@ func (r *LightRenderer) getch(nonblock bool) (int, bool) {
}
return int(b[0]), true
}
type window struct {
lines uint16
columns uint16
width uint16
height uint16
}
func (r *LightRenderer) Size() (termSize, error) {
w := new(window)
_, _, err := syscall.Syscall(syscall.SYS_IOCTL, r.ttyin.Fd(), syscall.TIOCGWINSZ, uintptr(unsafe.Pointer(w)))
if err != 0 {
return termSize{}, err
}
return termSize{int(w.lines), int(w.columns), int(w.width), int(w.height)}, nil
}