1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-11-25 22:32:32 +02:00
Commit Graph

9 Commits

Author SHA1 Message Date
Gusted
e9ffd5a79a fix: don't emit empty tail tokens (#1121)
When tokens are split into lines, tokens that end with a newline are
emitted again as an empty token, which is confusing and doesn't have any
benefit. This conversion shouldn't emit a empty tail token.

Adds a test.

I noticed this issue by a CI failure for the output of a Go program that
was changed because of
d0ad679444 and the new output contained a
empty whitespace token at the beginning of most lines.
2025-08-27 19:51:01 +10:00
Alec Thomas
0bd7c6851b chore: bump go.mod to Go 1.22 + add Iterator.Stdlib()
The Stdlib() function converts a Chroma iterator to a Go 1.23 iterator.
2025-01-09 19:28:28 +09:00
Alec Thomas
5da831672d Fix a few bugs including sub-lexers adding additional newlines when
EnsureNL is true.
2021-02-06 20:13:50 +11:00
Alec Thomas
da5ac60d8c Add golangci-lint and fix all lint issues. 2018-12-31 22:46:59 +11:00
Alec Thomas
881a441774 Don't keep trailing empty tokens when splitting tokens by line.
Fixes #155. Fixes #209.
2018-12-27 16:20:38 +11:00
Randall C. O'Reilly
a4f179974b move SplitTokensIntoLines into chroma/iterator.go, fixes issue #190 2018-11-08 16:21:45 +11:00
Daniel Eloff
9c3abeae1d Tokens by value (#187)
This results in about a 8% improvement in speed.
2018-11-04 10:22:51 +11:00
Alec Thomas
e2d6abaa64 Document and add iterator panic recovery. 2017-09-20 23:06:23 +10:00
Alec Thomas
cc0e4a59ab Switch to an Iterator interface.
This is to solve an issue where writers returned by the Formatter
were often stateful, but this fact was not obvious to the API consumer,
and failed in interesting ways.
2017-09-20 22:19:36 +10:00