go.talks/present: Lines.line should be always incremented with Lines.next()
Fixes golang/go#4516
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6943044
diff --git a/pkg/present/parse.go b/pkg/present/parse.go
index 43985af..a9e51e8 100644
--- a/pkg/present/parse.go
+++ b/pkg/present/parse.go
@@ -177,11 +177,12 @@
func (l *Lines) next() (text string, ok bool) {
for {
- if l.line >= len(l.text) {
+ current := l.line
+ l.line++
+ if current >= len(l.text) {
return "", false
}
- text = l.text[l.line]
- l.line++
+ text = l.text[current]
// Lines starting with # are comments.
if len(text) == 0 || text[0] != '#' {
ok = true