mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 23:18:33 +00:00
charset: Fix V695: dead branches
Based on comments it appears that some non-printable characters intended to be shown as `|x` (0xA0..0xFE) and some as `~x` (0x80..0x9F, 0xFF, excluding previous). But this never happens because this is being catched by condition `c >= 0x80` above which makes them be represented as `<A0>`. Since I find this variant more useful and it additionally is backwards compatible (Vim does the same thing) I just dropped dead branches.
This commit is contained in:
@@ -544,19 +544,9 @@ void transchar_nonprint(char_u *buf, int c)
|
||||
// DEL displayed as ^?
|
||||
buf[1] = (char_u)(c ^ 0x40);
|
||||
|
||||
buf[2] = NUL;
|
||||
} else if (c >= 0x80) {
|
||||
transchar_hex(buf, c);
|
||||
} else if ((c >= ' ' + 0x80) && (c <= '~' + 0x80)) {
|
||||
// 0xa0 - 0xfe
|
||||
buf[0] = '|';
|
||||
buf[1] = (char_u)(c - 0x80);
|
||||
buf[2] = NUL;
|
||||
} else {
|
||||
// 0x80 - 0x9f and 0xff
|
||||
buf[0] = '~';
|
||||
buf[1] = (char_u)((c - 0x80) ^ 0x40);
|
||||
buf[2] = NUL;
|
||||
transchar_hex(buf, c);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user