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 opts.strings() {
|
||||||
if in_string {
|
if in_string {
|
||||||
highlighting.push(highlighting::Type::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 == '"' {
|
if *c == '"' {
|
||||||
in_string = false;
|
in_string = false;
|
||||||
prev_is_separator = true;
|
prev_is_separator = true;
|
||||||
@ -256,8 +264,8 @@ impl Row {
|
|||||||
|
|
||||||
if opts.numbers() {
|
if opts.numbers() {
|
||||||
if (c.is_ascii_digit()
|
if (c.is_ascii_digit()
|
||||||
&& (prev_is_separator || previous_highlight == &highlighting::Type::Number))
|
&& (prev_is_separator || *previous_highlight == highlighting::Type::Number))
|
||||||
|| (c == &'.' && previous_highlight == &highlighting::Type::Number)
|
|| (*c == '.' && *previous_highlight == highlighting::Type::Number)
|
||||||
{
|
{
|
||||||
highlighting.push(highlighting::Type::Number)
|
highlighting.push(highlighting::Type::Number)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user