From 6fefe6641591f8cfb323e5c78c73d89ed0534066 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 12 Sep 2017 12:34:13 +0800 Subject: [PATCH] =?UTF-8?q?Replace=20invalid=20codepoints=20with=20?= =?UTF-8?q?=EF=BF=BD=20instead=20of=20U+XXXX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That way we get more predicitible column lenght with invalid codepoints. --- src/highlighters.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/highlighters.cc b/src/highlighters.cc index 653be6ca..56054f73 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -1165,6 +1165,7 @@ void highlight_selections(const Context& context, HighlightPass, DisplayBuffer& void expand_unprintable(const Context& context, HighlightPass, DisplayBuffer& display_buffer, BufferRange) { auto& buffer = context.buffer(); + auto error = get_face("Error"); for (auto& line : display_buffer.lines()) { for (auto atom_it = line.begin(); atom_it != line.end(); ++atom_it) @@ -1183,8 +1184,8 @@ void expand_unprintable(const Context& context, HighlightPass, DisplayBuffer& di if (it.coord() < atom_it->end()) atom_it = line.split(atom_it, it.coord()); - atom_it->replace(format("U+{}", hex(cp))); - atom_it->face = { Color::Red, Color::Black }; + atom_it->replace("�"); + atom_it->face = error; break; } }