still not right, but better stdout window

This commit is contained in:
Jeff Carr 2024-11-14 09:50:27 -06:00
parent 820f27c0a2
commit aea18d5b65
2 changed files with 14 additions and 4 deletions

View File

@ -21,11 +21,18 @@ func (f *FakeFile) Read(p []byte) (n int, err error) {
return n, err
}
var fakecount int = 0
func (f *FakeFile) Write(p []byte) (n int, err error) {
n, err = f.buffer.Write(p)
f.offset += int64(n)
f.reader.Reset(f.buffer.Bytes())
f.view.Write(p)
fakecount += 1
if fakecount > 20 {
fakecount = 0
f.view.Clear()
}
return n, err
}

View File

@ -143,16 +143,19 @@ func addDebugKeys(g *gocui.Gui) {
if tk.v == nil {
log.Log(ERROR, "tk.v = nil")
} else {
log.Log(ERROR, "setting log.CaptureMode(tk.v)")
log.Log(ERROR, "setting log.CaptureMode(tk.v)")
log.CaptureMode(tk.v)
// log.Log(ERROR, "setting log.CaptureMode(tk.v)")
// log.Log(ERROR, "setting log.CaptureMode(tk.v)")
// log.CaptureMode(tk.v)
}
if me.fakefile == nil {
log.Log(ERROR, "making fakefile")
me.fakefile = NewFakeFile(tk.v)
log.Log(ERROR, "setting log.CaptureMode(fakefile)")
log.CaptureMode(me.fakefile)
log.Log(ERROR, "set log.CaptureMode(fakefile)")
} else {
log.Log(ERROR, "attempt write to fakefile")
fmt.Fprintf(me.fakefile, "test out fakefile %d\n", ecount)
fmt.Fprintf(me.fakefile, "test out fakefile ecount=%d fakecount=%d\n", ecount, fakecount)
}
return nil
})