Continue highlighting escaped characters
This commit is contained in:
parent
6ee4c092f9
commit
6267dc4888
12
src/row.rs
12
src/row.rs
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user