From 1621fa43d849326fe956d460e982253488dbf58e Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Thu, 29 Dec 2016 12:24:56 -0800 Subject: [PATCH] don't mix narrow and wide stdio Fixes #3686 --- src/fish_tests.cpp | 6 ++---- src/reader.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index f19a6783f..387cd73e3 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -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; } diff --git a/src/reader.cpp b/src/reader.cpp index d77cee9d4..334c6edc8 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -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()) {