Skip to content

Commit

Permalink
comment out logging
Browse files Browse the repository at this point in the history
  • Loading branch information
xt0fer committed Nov 26, 2018
1 parent 2897f20 commit 0dbc10f
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 231 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ debug.out

kg
logfile
foo
cmd
hello
3 changes: 1 addition & 2 deletions ToDo.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# To Do

* search commented out
* mouse to change windows
* mouse to change windows (only works with one-window)
7 changes: 3 additions & 4 deletions buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package kg
import (
"errors"
"fmt"
"log"
"runtime"
)

Expand Down Expand Up @@ -66,9 +65,9 @@ func (bp *Buffer) logBufferEOB(pt int) {
pc, file, no, ok := runtime.Caller(1)
details := runtime.FuncForPC(pc)
if ok && details != nil {
log.Printf(">>Called from %s\n>> %s Ln# %d\n", details.Name(), file, no)
// log.Printf(">>Called from %s\n>> %s Ln# %d\n", details.Name(), file, no)
}
log.Println(">>Setting Point to EOB", pt, bp.BufferLen())
// log.Println(">>Setting Point to EOB", pt, bp.BufferLen())
}
}

Expand Down Expand Up @@ -129,7 +128,7 @@ func (bp *Buffer) SetPoint(np int) {
bp.postLen++
}
if bp.PageEnd < bp.preLen {
//log.Println("reframing!")
//// log.Println("reframing!")
bp.Reframe = true
}
}
Expand Down
7 changes: 3 additions & 4 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package kg

import (
"io/ioutil"
"log"
"strconv"
"strings"
"unicode"
Expand Down Expand Up @@ -259,13 +258,13 @@ func (e *Editor) copyCut(cut bool) {
rch, err := bp.RuneAt(l)
if err != nil {
e.msg("Copy/Cut failed. %s", err)
log.Println("Copy/Cut failed.", err)
// log.Println("Copy/Cut failed.", err)
}
scrap[k] = rch
log.Println("rune", rch)
// log.Println("rune", rch)
l++
}
//log.Printf("CopyCut start %d len %d, %#v", start, extent, scrap)
//// log.Printf("CopyCut start %d len %d, %#v", start, extent, scrap)
e.PasteBuffer = string(scrap)
if cut == true {
bp.Remove(start, extent)
Expand Down
File renamed without changes.
36 changes: 17 additions & 19 deletions editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package kg

import (
"fmt"
"log"
"os"
"strings"
"unicode"

Expand Down Expand Up @@ -57,19 +55,19 @@ type Editor struct {
// StartEditor is the old C main function
func (e *Editor) StartEditor(argv []string, argc int) {
// log setup....
f, err := os.OpenFile("logfile", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("error opening file: %v", err)
}
defer f.Close()

log.SetOutput(f)
f.Truncate(0)
log.Println("Start of Log...")
// f, err := os.OpenFile("logfile", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
// if err != nil {
// log.Fatalf("error opening file: %v", err)
// }
// defer f.Close()

// log.SetOutput(f)
// f.Truncate(0)
// // log.Println("Start of Log...")
//
e.FGColor = termbox.ColorDefault
e.BGColor = termbox.ColorWhite
err = termbox.Init()
err := termbox.Init()
checkErr(err)
defer termbox.Close()
e.Cols, e.Lines = termbox.Size()
Expand Down Expand Up @@ -120,8 +118,8 @@ func (e *Editor) StartEditor(argv []string, argc int) {
for {
select {
case ev := <-e.EventChan:
//log.Printf("%#v\n", ev)
//log.Println(">>\n ", time.Now().Unix(), "\n>>")
//// log.Printf("%#v\n", ev)
//// log.Println(">>\n ", time.Now().Unix(), "\n>>")

ok := e.handleEvent(&ev)
if !ok {
Expand Down Expand Up @@ -233,7 +231,7 @@ func (e *Editor) searchAndPerform(ev *termbox.Event) bool {
}
for i, j := range e.Keymap {
if strings.Compare(lookfor, j.KeyBytes) == 0 {
//log.Println("SearchAndPerform FOUND ", lookfor, e.Keymap[i])
//// log.Println("SearchAndPerform FOUND ", lookfor, e.Keymap[i])
do := e.Keymap[i].Do
if do != nil {
do(e) // execute function for key
Expand Down Expand Up @@ -311,7 +309,7 @@ func (e *Editor) Display(wp *Window, shouldDrawCursor bool) {
}
rch, err := bp.RuneAt(k)
if err != nil {
log.Println("Error on RuneAt", err)
// log.Println("Error on RuneAt", err)
}
if rch != '\r' {
if unicode.IsPrint(rch) || rch == '\t' || rch == '\n' {
Expand Down Expand Up @@ -358,7 +356,7 @@ func (e *Editor) setTermCursor(c, r int) {
wp := e.CurrentWindow
wp.Col, wp.Row = c, r
termbox.SetCursor(c, r)
//log.Printf("c %d r %d\n", c, r)
//// log.Printf("c %d r %d\n", c, r)
}

func (e *Editor) updateDisplay() {
Expand Down Expand Up @@ -601,8 +599,8 @@ func (e *Editor) splitWindow() {
e.CurrentWindow.Rows = ntru
nwp.TopPt = e.CurrentWindow.TopPt + ntru + 2
nwp.Rows = ntrl - 1
log.Printf("New win %d %d\n", nwp.TopPt, nwp.Rows)
log.Printf("Old win %d %d\n", e.CurrentWindow.TopPt, e.CurrentWindow.Rows)
// log.Printf("New win %d %d\n", nwp.TopPt, nwp.Rows)
// log.Printf("Old win %d %d\n", e.CurrentWindow.TopPt, e.CurrentWindow.Rows)

/* insert it in the list */
wp2 := e.CurrentWindow.Next
Expand Down
Binary file removed hello/hello
Binary file not shown.
6 changes: 2 additions & 4 deletions search.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package kg

import "log"

const (
fwdsearch = 1
revsearch = 2
Expand Down Expand Up @@ -52,7 +50,7 @@ func (bp *Buffer) searchForward(startp int, stext string) int {
}
}
if ss == len(s) {
log.Printf("Found %s at pt %d\n", stext, pp)
// log.Printf("Found %s at pt %d\n", stext, pp)
return pp
}
}
Expand All @@ -77,7 +75,7 @@ func (bp *Buffer) searchBackwards(startp int, stext string) int {
}
}
if ss == len(s) {
log.Printf("Found %s at pt %d\n", stext, pp)
// log.Printf("Found %s at pt %d\n", stext, pp)
return pp
}
}
Expand Down
194 changes: 0 additions & 194 deletions test.txt

This file was deleted.

Loading

0 comments on commit 0dbc10f

Please sign in to comment.