Continue highlighting escaped characters

This commit is contained in:
Timothy Warren 2021-03-16 10:49:15 -04:00
parent 6ee4c092f9
commit 6267dc4888

View File

@ -235,6 +235,14 @@ impl Row {
if opts.strings() {
if in_string {
highlighting.push(highlighting::Type::String);
// Don't let an escaped character stop string highlighting
if *c == '\\' && index < self.len().saturating_sub(1) {
highlighting.push(highlighting::Type::String);
index += 2;
continue;
}
if *c == '"' {
in_string = false;
prev_is_separator = true;
@ -256,8 +264,8 @@ impl Row {
if opts.numbers() {
if (c.is_ascii_digit()
&& (prev_is_separator || previous_highlight == &highlighting::Type::Number))
|| (c == &'.' && previous_highlight == &highlighting::Type::Number)
&& (prev_is_separator || *previous_highlight == highlighting::Type::Number))
|| (*c == '.' && *previous_highlight == highlighting::Type::Number)
{
highlighting.push(highlighting::Type::Number)
} else {