diff options
Diffstat (limited to 'stdoutShow.go')
| -rw-r--r-- | stdoutShow.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/stdoutShow.go b/stdoutShow.go index 61f2246..24f1e66 100644 --- a/stdoutShow.go +++ b/stdoutShow.go @@ -175,3 +175,19 @@ func (w *guiWidget) Write(p []byte) (n int, err error) { return len(p), nil } + +// lets the user page up and down through the stdout buffer +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))) + return + } + + var cur []string + // chop off the last lines in the buffer + chop := len(me.stdout.outputS) - (me.stdout.pager + me.stdout.h) + cur = append(cur, me.stdout.outputS[chop:chop+me.stdout.h]...) + slices.Reverse(cur) + tk.v.Clear() + fmt.Fprintln(tk.v, strings.Join(cur, "\n")) +} |
