diff --git a/fakefile.go b/fakefile.go index 9c74daa..5c54762 100644 --- a/fakefile.go +++ b/fakefile.go @@ -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 } diff --git a/keybindings.go b/keybindings.go index 15d0821..f9fa0b4 100644 --- a/keybindings.go +++ b/keybindings.go @@ -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 })