don't mix narrow and wide stdio

Fixes #3686
This commit is contained in:
Kurtis Rader 2016-12-29 12:24:56 -08:00
parent 3da3558e35
commit 1621fa43d8
2 changed files with 6 additions and 8 deletions

View file

@ -116,7 +116,7 @@ static void err(const wchar_t *blah, ...) {
// Show errors in red.
if (colorize) {
fputs("\e[31m", stdout);
fputws(L"\e[31m", stdout);
}
wprintf(L"Error: ");
vwprintf(blah, va);
@ -124,7 +124,7 @@ static void err(const wchar_t *blah, ...) {
// Return to normal color.
if (colorize) {
fputs("\e[0m", stdout);
fputws(L"\e[0m", stdout);
}
wprintf(L"\n");
@ -2450,7 +2450,6 @@ static int test_universal_helper(int *x) {
if (!synced) {
err(L"Failed to sync universal variables after modification");
}
fputc('.', stderr);
}
// Last step is to delete the first key.
@ -2459,7 +2458,6 @@ static int test_universal_helper(int *x) {
if (!synced) {
err(L"Failed to sync universal variables after deletion");
}
fputc('.', stderr);
return 0;
}

View file

@ -698,17 +698,17 @@ void reader_write_title(const wcstring &cmd, bool reset_cursor_position) {
proc_push_interactive(0);
if (exec_subshell(fish_title_command, lst, false /* ignore exit status */) != -1 &&
!lst.empty()) {
fputs("\e]0;", stdout);
fputws(L"\e]0;", stdout);
for (size_t i = 0; i < lst.size(); i++) {
fputws(lst.at(i).c_str(), stdout);
}
fputc('\a', stdout);
fputwc(L'\a', stdout);
}
proc_pop_interactive();
set_color(rgb_color_t::reset(), rgb_color_t::reset());
if (reset_cursor_position && !lst.empty()) {
// Put the cursor back at the beginning of the line (issue #2453).
fputc('\r', stdout);
fputwc(L'\r', stdout);
}
}
@ -3260,7 +3260,7 @@ const wchar_t *reader_readline(int nchars) {
reader_repaint_if_needed();
}
fputc('\n', stdout);
fputwc(L'\n', stdout);
// Ensure we have no pager contents when we exit.
if (!data->pager.empty()) {