Skip to content

Commit

Permalink
Merge pull request #23 from lucblassel/trailing_whitespace
Browse files Browse the repository at this point in the history
Fixing newick parsing
  • Loading branch information
fredericlemoine committed Apr 29, 2024
2 parents df34e91 + b959a7f commit c8ec0e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ The `gotree` executable should be located in the current folder (or the `$GOPATH

To test the executable:
```
./test.sh
bash test.sh
```

## Auto completion
Expand Down
8 changes: 7 additions & 1 deletion io/fileutils/readln.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ func ReadUntilSemiColon(r *bufio.Reader) (string, error) {
line, isPrefix, err = r.ReadLine()
ln = append(ln, line...)
if len(ln) > 0 {
lastChar = ln[len(ln)-1]
i := len(ln) - 1
lastChar = ln[i]
// Test what last non-space character of the line is
for (lastChar == ' ' || lastChar == '\t') && i >= 0 {
i--
lastChar = ln[i]
}
}
}
return string(ln), err
Expand Down

0 comments on commit c8ec0e0

Please sign in to comment.