Skip to content

Commit

Permalink
Step 161
Browse files Browse the repository at this point in the history
  • Loading branch information
bediger4000 committed Jun 7, 2017
1 parent 451d434 commit a8d379a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions kilo.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,21 @@ func isSeparator(c byte) bool {

func editorUpdateSyntax(row *erow) {
row.hl = make([]byte, row.rsize)
if E.syntax == nil { return }
prevSep := true
var prevHl byte = HL_NORMAL
for i, c := range row.render {
if i > 0 {
prevHl = row.hl[i - 1]
}
if (c >= '0' && c <= '9') && (prevSep ||
prevHl == HL_NUMBER) ||
(c == '.' && prevHl == HL_NUMBER) {
row.hl[i] = HL_NUMBER
prevSep = false
continue
if (E.syntax.flags & HL_HIGHLIGHT_NUMBERS) == HL_HIGHLIGHT_NUMBERS {
if (c >= '0' && c <= '9') &&
(prevSep || prevHl == HL_NUMBER) ||
(c == '.' && prevHl == HL_NUMBER) {
row.hl[i] = HL_NUMBER
prevSep = false
continue
}
}
prevSep = isSeparator(c)
}
Expand Down

0 comments on commit a8d379a

Please sign in to comment.