Skip to content

Commit

Permalink
Retain all newlines and carriage returns when parsing files
Browse files Browse the repository at this point in the history
  • Loading branch information
mkchoi212 committed Dec 31, 2017
1 parent 131da5d commit b7b7aa5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (

func printLines(v *gocui.View, lines []string) {
for _, line := range lines {
fmt.Fprintln(v, line)
fmt.Fprintf(v, line)
}
}

Expand Down
6 changes: 0 additions & 6 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ func ReadFile(absPath string) error {
for {
data, err := r.ReadBytes('\n')
if err == nil || err == io.EOF {
if len(data) > 0 && data[len(data)-1] == '\n' {
data = data[:len(data)-1]
}
if len(data) > 0 && data[len(data)-1] == '\r' {
data = data[:len(data)-1]
}
allFileLines[absPath] = append(allFileLines[absPath], string(data))
}

Expand Down
2 changes: 1 addition & 1 deletion summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func WriteChanges(fname string) error {

for _, l := range allFileLines[fname] {
if l != "" {
fmt.Println(l)
fmt.Printf(l)
}
}
return nil
Expand Down

0 comments on commit b7b7aa5

Please sign in to comment.