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

Revert "Sixel and Kitty image support on Windows binary (#2544)"

This reverts commit 68db9cb499.
This commit is contained in:
Junegunn Choi
2023-11-10 12:55:18 +09:00
parent 1084935241
commit 38e3694d1c
9 changed files with 34 additions and 66 deletions

View File

@@ -1962,8 +1962,6 @@ func (t *Terminal) renderPreviewArea(unchanged bool) {
if t.previewed.wipe && t.previewed.version != t.previewer.version {
t.previewed.wipe = false
t.pwindow.Erase()
// Required for tcell to clear the previous image
t.tui.Sync(true)
} else if unchanged {
t.pwindow.MoveAndClear(0, 0) // Clear scroll offset display
} else {
@@ -2094,10 +2092,6 @@ Loop:
for i := y + 1; i < height; i++ {
t.pwindow.MoveAndClear(i, 0)
}
// Required for tcell to clear the previous text
if !t.previewed.image {
t.tui.Sync(false)
}
}
image = image || isImage
if idx == 0 {
@@ -2105,7 +2099,7 @@ Loop:
} else {
t.pwindow.Move(y, x)
}
t.tui.PassThrough(t.pwindow.Top()+y, t.pwindow.Left()+x, passThrough)
t.tui.PassThrough(passThrough)
if requiredLines > 0 {
if y+requiredLines == height {

View File

@@ -33,8 +33,7 @@ func (r *FullscreenRenderer) Init() {}
func (r *FullscreenRenderer) Resize(maxHeightFunc func(int) int) {}
func (r *FullscreenRenderer) Pause(bool) {}
func (r *FullscreenRenderer) Resume(bool, bool) {}
func (r *FullscreenRenderer) PassThrough(int, int, string) {}
func (r *FullscreenRenderer) Sync(bool) {}
func (r *FullscreenRenderer) PassThrough(string) {}
func (r *FullscreenRenderer) Clear() {}
func (r *FullscreenRenderer) NeedScrollbarRedraw() bool { return false }
func (r *FullscreenRenderer) Refresh() {}

View File

@@ -31,12 +31,8 @@ const consoleDevice string = "/dev/tty"
var offsetRegexp *regexp.Regexp = regexp.MustCompile("(.*)\x1b\\[([0-9]+);([0-9]+)R")
var offsetRegexpBegin *regexp.Regexp = regexp.MustCompile("^\x1b\\[[0-9]+;[0-9]+R")
func (r *LightRenderer) PassThrough(y int, x int, data string) {
r.queued.WriteString("\x1b7" + data + "\x1b8")
}
func (r *LightRenderer) Sync(bool) {
// No-op
func (r *LightRenderer) PassThrough(str string) {
r.queued.WriteString("\x1b7" + str + "\x1b8")
}
func (r *LightRenderer) stderr(str string) {

View File

@@ -110,16 +110,24 @@ func (r *LightRenderer) restoreTerminal() error {
return windows.SetConsoleMode(windows.Handle(r.outHandle), r.origStateOutput)
}
func (r *LightRenderer) updateTerminalSize() {
func (r *LightRenderer) Size() TermSize {
var w, h int
var bufferInfo windows.ConsoleScreenBufferInfo
if err := windows.GetConsoleScreenBufferInfo(windows.Handle(r.outHandle), &bufferInfo); err != nil {
r.width = getEnv("COLUMNS", defaultWidth)
r.height = r.maxHeightFunc(getEnv("LINES", defaultHeight))
w = getEnv("COLUMNS", defaultWidth)
h = r.maxHeightFunc(getEnv("LINES", defaultHeight))
} else {
r.width = int(bufferInfo.Window.Right - bufferInfo.Window.Left)
r.height = r.maxHeightFunc(int(bufferInfo.Window.Bottom - bufferInfo.Window.Top))
w = int(bufferInfo.Window.Right - bufferInfo.Window.Left)
h = r.maxHeightFunc(int(bufferInfo.Window.Bottom - bufferInfo.Window.Top))
}
return TermSize{h, w, 0, 0}
}
func (r *LightRenderer) updateTerminalSize() {
size := r.Size()
r.width = size.Columns
r.height = size.Lines
}
func (r *LightRenderer) findOffset() (row int, col int) {

View File

@@ -98,22 +98,9 @@ const (
AttrClear = Attr(1 << 8)
)
func (r *FullscreenRenderer) PassThrough(y int, x int, data string) {
tty, _ := _screen.Tty()
ti, err := tcell.LookupTerminfo(os.Getenv("TERM"))
if err != nil {
return
}
ti.TPuts(tty, ti.TGoto(x, y))
ti.TPuts(tty, data)
}
func (r *FullscreenRenderer) Sync(hard bool) {
if hard {
_screen.Sync()
} else {
_screen.Show()
}
func (r *FullscreenRenderer) PassThrough(str string) {
// No-op
// https://github.com/gdamore/tcell/issues/363#issuecomment-680665073
}
func (r *FullscreenRenderer) Resize(maxHeightFunc func(int) int) {}
@@ -220,10 +207,10 @@ func (r *FullscreenRenderer) Refresh() {
// noop
}
// TODO: Pixel width and height not implemented
func (r *FullscreenRenderer) Size() TermSize {
tty, _ := _screen.Tty()
ws, _ := tty.WindowSize()
return TermSize{ws.Height, ws.Width, ws.PixelWidth, ws.PixelHeight}
cols, lines := _screen.Size()
return TermSize{lines, cols, 0, 0}
}
func (r *FullscreenRenderer) GetChar() Event {

View File

@@ -489,8 +489,7 @@ type Renderer interface {
RefreshWindows(windows []Window)
Refresh()
Close()
PassThrough(y int, x int, data string)
Sync(bool)
PassThrough(string)
NeedScrollbarRedraw() bool
GetChar() Event