diff --git a/buffer.go b/buffer.go index decb440..2c30f30 100644 --- a/buffer.go +++ b/buffer.go @@ -3,7 +3,6 @@ package kg import ( "errors" "fmt" - "log" ) /* @@ -66,7 +65,7 @@ func (bp *Buffer) getText() string { // RuneAt finally reliable!! (well, maybe not) func (bp *Buffer) RuneAt(pt int) (rune, error) { - log.Println("RuneAt pt = ", pt) + //log.Println("RuneAt pt = ", pt) if pt >= len(bp.data) { return 0, errors.New("beyond data buffer in RuneAt") } @@ -107,7 +106,7 @@ func (bp *Buffer) SetPoint(np int) { //bp.MoveGap(np - bp.Point) // move gap <-(left) by np chars gs := bp.gapStart() - log.Printf("gap start %d len %d new pt %d dist %d\n", gs, bp.gapLen(), np, gs-np) + //log.Printf("gap start %d len %d new pt %d dist %d\n", gs, bp.gapLen(), np, gs-np) f := 0 for i := gs - np; i > 0; i-- { bp.data[bp.postStart()-1] = bp.data[bp.Point-1] @@ -115,7 +114,7 @@ func (bp *Buffer) SetPoint(np int) { bp.postLen++ f++ } - log.Printf("shuffled %d\n", f) + //log.Printf("shuffled %d\n", f) if bp.PageEnd < bp.Point { bp.Reframe = true diff --git a/editor.go b/editor.go index f44fbfb..17d8a4b 100644 --- a/editor.go +++ b/editor.go @@ -390,9 +390,13 @@ func (e *Editor) SetPointForMouse(mc, mr int) { } func (e *Editor) setWindowForMouse(mc, mr int) (c, r int) { - log.Printf("col %d row %d ", mc, mr) + log.Printf("setWindowForMouse col %d row %d ", mc, mr) wp := e.RootWindow + // if mr is modeline or modeline+1, reduce to last wp.Rows + if mr > wp.Rows { + mr = wp.Rows + } for wp != nil { if (mr <= wp.Rows+wp.TopPt) && (mr >= wp.TopPt) { log.Printf("set win rows %d top %d\n", wp.Rows, wp.TopPt)