Use reverse highlight for search, so multiline comments can be blue

This commit is contained in:
Timothy Warren 2019-09-09 13:27:11 -04:00
parent 788edf7e03
commit 934791d1c4
1 changed files with 6 additions and 3 deletions

View File

@ -637,10 +637,10 @@ impl Editor {
Keyword1 => 33, // Yellow Keyword1 => 33, // Yellow
Keyword2 => 32, // Green Keyword2 => 32, // Green
LineComment => 36, // Cyan LineComment => 36, // Cyan
MultiLineComment => 36, // Cyan MultiLineComment => 34, // Blue
Normal => 37, Normal => 37, // White
Number => 31, // Red Number => 31, // Red
SearchMatch => 34, // Blue SearchMatch => 7, // Reverse!
String => 35, // Magenta String => 35, // Magenta
} }
} }
@ -979,6 +979,7 @@ impl Editor {
} }
} else if self.rows[file_row].highlight[x] == Highlight::Normal { } else if self.rows[file_row].highlight[x] == Highlight::Normal {
if current_color != -1 { if current_color != -1 {
self.append_out("\x1b[0m");
self.append_out("\x1b[39m"); self.append_out("\x1b[39m");
current_color = -1; current_color = -1;
} }
@ -988,11 +989,13 @@ impl Editor {
if color != current_color { if color != current_color {
current_color = color; current_color = color;
let code = format!("\x1b[{}m", color); let code = format!("\x1b[{}m", color);
self.append_out("\x1b[0m");
self.append_out(&code); self.append_out(&code);
} }
self.append_out_char(ch); self.append_out_char(ch);
} }
} }
self.append_out("\x1b[0m");
self.append_out("\x1b[39m"); self.append_out("\x1b[39m");
} }