Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This fixes a bug and adds a feature #111

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix the bug where whitespace is inserted.
It seems that `\n` is identified as a valid token and then the same
substring (`\n`) is both inserted as whitespace and as a token.

This causes the insertion of additional whitespace at the beginning
of the code.
  • Loading branch information
terhechte committed Jun 7, 2020
commit 63c7a41c8b357e09bfedff133e7773119f807d6f
5 changes: 3 additions & 2 deletions Sources/Splash/Syntax/SyntaxHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public struct SyntaxHighlighter<Format: OutputFormat> {
state = (token, type)
return
}

builder.addToken(token, ofType: type)
if token != whitespace {
builder.addToken(token, ofType: type)
}
builder.addWhitespace(whitespace)
state = nil
}
Expand Down