summaryrefslogtreecommitdiff
path: root/stdoutShow.go
diff options
context:
space:
mode:
Diffstat (limited to 'stdoutShow.go')
-rw-r--r--stdoutShow.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/stdoutShow.go b/stdoutShow.go
index 5e3b305..2c9cd58 100644
--- a/stdoutShow.go
+++ b/stdoutShow.go
@@ -133,6 +133,13 @@ func (tk *guiWidget) relocateStdout(w int, h int) {
// of functions like fmt.Fprintf, fmt.Fprintln, io.Copy, etc. Clear must
// be called to clear the view's buffer.
+func (w stdout) Height() int {
+ if w.tk == nil {
+ return 40
+ }
+ return w.tk.gocuiSize.Height() - 2
+}
+
func (w stdout) Write(p []byte) (n int, err error) {
me.writeMutex.Lock()
defer me.writeMutex.Unlock()
@@ -200,6 +207,11 @@ func (w *guiWidget) Write(p []byte) (n int, err error) {
func (tk *guiWidget) refreshStdout() {
if len(me.stdout.outputS) < me.stdout.h+me.stdout.pager {
// log.Info(fmt.Sprintf("buffer too small=%d len(%d)", me.stdout.pager, len(me.stdout.outputS)))
+ var cur []string
+ cur = append(cur, me.stdout.outputS...)
+ slices.Reverse(cur)
+ tk.v.Clear()
+ fmt.Fprintln(tk.v, strings.Join(cur, "\n"))
return
}