Use alternative Unicode glyphs if compiled under Windows/WSL

The two unicode glyphs used to represent missing new lines and redacted
characters for secure entry are both not present in the glyph tables of
the default font under Windows (Consolas and Lucida Console), use an
alternative glyph instead.

The "return" symbol is replaced with a pilcrow (¶) and the "redacted
character" symbol is replaced with a bullet (•). Both of these are
well-defined in almost all fonts as they're very old symbols. This
change only takes place if -DWSL is supplied by the build toolchain.

Note: this means a Windows SSH client connecting to a fish remote
instance on a non-Windows machine will still use the (unavailable)
default glyphs instead.
This commit is contained in:
Mahmoud Al-Qudsi 2018-03-28 14:27:25 -05:00
parent adbaddfaf4
commit 412c5aeaa6

View file

@ -525,8 +525,16 @@ void fish_setlocale() {
ellipsis_char = L'$'; // "horizontal ellipsis"
ellipsis_str = L"...";
}
omitted_newline_char = can_be_encoded(L'\u23CE') ? L'\u23CE' : L'~'; // "return"
obfuscation_read_char = can_be_encoded(L'\u25CF') ? L'\u25CF' : L'#'; // "black circle"
if (is_windows_subsystem_for_linux()) {
//neither of \u23CE and \u25CF can be displayed in the default fonts on Windows, though
//they can be *encoded* just fine. Use alternative glyphs.
omitted_newline_char = can_be_encoded(L'\u00b6') ? L'\u00b6' : L'~'; // "pilcrow"
obfuscation_read_char = can_be_encoded(L'\u2022') ? L'\u2022' : L'*'; // "bullet"
}
else {
omitted_newline_char = can_be_encoded(L'\u23CE') ? L'\u23CE' : L'~'; // "return"
obfuscation_read_char = can_be_encoded(L'\u25CF') ? L'\u25CF' : L'#'; // "black circle"
}
}
long read_blocked(int fd, void *buf, size_t count) {