summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-11-10 12:55:18 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-11-10 13:16:11 +0900
commit38e3694d1ca5f138f26fbbffb7c0122b58eee8dc (patch)
tree70adaeba1deef894b5c3fc73470c23c239d132ec /src
parent108493524110c8f996231eb5e51b93da7a9b57ca (diff)
Revert "Sixel and Kitty image support on Windows binary (#2544)"
Diffstat (limited to 'src')
-rw-r--r--src/terminal.go8
-rw-r--r--src/tui/dummy.go3
-rw-r--r--src/tui/light.go8
-rw-r--r--src/tui/light_windows.go18
-rw-r--r--src/tui/tcell.go25
-rw-r--r--src/tui/tui.go3
6 files changed, 24 insertions, 41 deletions
diff --git a/src/terminal.go b/src/terminal.go
index f48e5f25..1802e446 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -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 {
diff --git a/src/tui/dummy.go b/src/tui/dummy.go
index d6495816..cceb4478 100644
--- a/src/tui/dummy.go
+++ b/src/tui/dummy.go
@@ -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() {}
diff --git a/src/tui/light.go b/src/tui/light.go
index dd1f9f3d..e5950cde 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -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) {
diff --git a/src/tui/light_windows.go b/src/tui/light_windows.go
index db829d3a..62b10c12 100644
--- a/src/tui/light_windows.go
+++ b/src/tui/light_windows.go
@@ -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) {
diff --git a/src/tui/tcell.go b/src/tui/tcell.go
index bf7b57cb..38641f7a 100644
--- a/src/tui/tcell.go
+++ b/src/tui/tcell.go
@@ -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 {
diff --git a/src/tui/tui.go b/src/tui/tui.go
index 6834f350..5a5e18d6 100644
--- a/src/tui/tui.go
+++ b/src/tui/tui.go
@@ -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