Fix #2973 in Windows CRLF env.
This commit is contained in:
parent
a1ee7e9565
commit
f3f511af1b
1 changed files with 7 additions and 1 deletions
|
|
@ -1304,7 +1304,13 @@ impl<'a> Iterator for LineClasses<'a> {
|
|||
None => FullCodeCharKind::Normal,
|
||||
};
|
||||
|
||||
while let Some((kind, c)) = self.base.next() {
|
||||
while let Some((kind, mut c)) = self.base.next() {
|
||||
// If \r\n newline appears, consume one more character.
|
||||
// Then do the same process with the single \n case.
|
||||
if c == '\r' && self.base.peek().map_or(false, |(_, c2)| *c2 == '\n') {
|
||||
self.base.next();
|
||||
c = '\n';
|
||||
}
|
||||
if c == '\n' {
|
||||
self.kind = match (start_class, kind) {
|
||||
(FullCodeCharKind::Normal, FullCodeCharKind::InString) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue