From 412c5aeaa63caa3534a0b966e3ad510969904dc6 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 28 Mar 2018 14:27:25 -0500 Subject: [PATCH] Use alternative Unicode glyphs if compiled under Windows/WSL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/common.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common.cpp b/src/common.cpp index f20f5206f..d39a8a5cb 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -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) {