From 9ab2c2ec6f41485f30a6f41acc507a8336e6e9af Mon Sep 17 00:00:00 2001 From: Joe Lim <50560759+joelim-work@users.noreply.github.com> Date: Mon, 23 Oct 2023 06:06:19 +1100 Subject: [PATCH] Print sixel data to stderr instead of stdout (#1451) --- sixel.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sixel.go b/sixel.go index 0a300052..36ca8c88 100644 --- a/sixel.go +++ b/sixel.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "os" "strings" "github.com/gdamore/tcell/v2" @@ -43,12 +44,12 @@ func (sxs *sixelScreen) showSixels() { } // XXX: workaround for bug where quitting lf might leave the terminal in bold - fmt.Print("\033[0m") + fmt.Fprint(os.Stderr, "\033[0m") - fmt.Print("\0337") // Save cursor position - fmt.Printf("\033[%d;%dH", sxs.yprev, sxs.xprev) // Move cursor to position - fmt.Print(*sxs.sixel) // - fmt.Print("\0338") // Restore cursor position + fmt.Fprint(os.Stderr, "\0337") // Save cursor position + fmt.Fprintf(os.Stderr, "\033[%d;%dH", sxs.yprev, sxs.xprev) // Move cursor to position + fmt.Fprint(os.Stderr, *sxs.sixel) // + fmt.Fprint(os.Stderr, "\0338") // Restore cursor position } func (sxs *sixelScreen) printSixel(win *win, screen tcell.Screen, reg *reg) {