mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 01:04:10 +08:00
use fish_wcwidth rather than wcwidth
Minor cleanup related to issue #2199.
This commit is contained in:
parent
1be3fe6633
commit
d70be18c42
@ -471,10 +471,10 @@ wchar_t *quote_end(const wchar_t *pos) {
|
||||
|
||||
void fish_setlocale() {
|
||||
// Use ellipsis if on known unicode system, otherwise use $.
|
||||
ellipsis_char = (wcwidth(L'\x2026') > 0) ? L'\x2026' : L'$';
|
||||
ellipsis_char = (fish_wcwidth(L'\x2026') > 0) ? L'\x2026' : L'$';
|
||||
|
||||
// U+23CE is the "return" character
|
||||
omitted_newline_char = (wcwidth(L'\x23CE') > 0) ? L'\x23CE' : L'~';
|
||||
omitted_newline_char = (fish_wcwidth(L'\x23CE') > 0) ? L'\x23CE' : L'~';
|
||||
}
|
||||
|
||||
bool contains_internal(const wchar_t *a, int vararg_handle, ...) {
|
||||
|
@ -67,15 +67,15 @@ static int print_max(const wcstring &str, highlight_spec_t color, int max, bool
|
||||
for (size_t i = 0; i < str.size(); i++) {
|
||||
wchar_t c = str.at(i);
|
||||
|
||||
if (written + wcwidth(c) > max) break;
|
||||
if ((written + wcwidth(c) == max) && (has_more || i + 1 < str.size())) {
|
||||
if (written + fish_wcwidth(c) > max) break;
|
||||
if ((written + fish_wcwidth(c) == max) && (has_more || i + 1 < str.size())) {
|
||||
line->append(ellipsis_char, color);
|
||||
written += wcwidth(ellipsis_char);
|
||||
written += fish_wcwidth(ellipsis_char);
|
||||
break;
|
||||
}
|
||||
|
||||
line->append(c, color);
|
||||
written += wcwidth(c);
|
||||
written += fish_wcwidth(c);
|
||||
}
|
||||
return written;
|
||||
}
|
||||
|
@ -1180,9 +1180,9 @@ void s_reset(screen_t *s, screen_reset_mode_t mode) {
|
||||
wcstring abandon_line_string;
|
||||
abandon_line_string.reserve(screen_width + 32); // should be enough
|
||||
|
||||
// Don't need to check for wcwidth errors; this is done when setting up omitted_newline_char
|
||||
// in common.cpp.
|
||||
int non_space_width = wcwidth(omitted_newline_char);
|
||||
// Don't need to check for fish_wcwidth errors; this is done when setting up
|
||||
// omitted_newline_char in common.cpp.
|
||||
int non_space_width = fish_wcwidth(omitted_newline_char);
|
||||
if (screen_width >= non_space_width) {
|
||||
bool has_256_colors = output_get_color_support() & color_support_term256;
|
||||
if (has_256_colors) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user