diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-06-20 20:56:38 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-06-20 23:43:21 +0100 |
| commit | 2edea2e0f6c0e317111fc6858c0d7a8f1070d3a3 (patch) | |
| tree | 53af0f612130624fdc55759acd34ef9e1fb6d559 /src | |
| parent | 91bf0d4622181c2faff621feb6241204eefa09b8 (diff) | |
Use fputs and fflush in ncurses_ui direct stdout access to respect buffering
Ncurses will write using the FILE* interface, using the fd based one is error
prone.
Fixes #703
Diffstat (limited to 'src')
| -rw-r--r-- | src/ncurses_ui.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 94c733cc..6e19310c 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -413,7 +413,8 @@ void NCursesUI::draw_status(const DisplayLine& status_line, for (auto& atom : mode_line) title += atom.content(); title += " - Kakoune\007"; - write_stdout(title); + fputs(stdout, title.c_str()); + fflush(stdout); } m_dirty = true; @@ -446,7 +447,7 @@ void NCursesUI::check_resize(bool force) m_dimensions = CharCoord{ws.ws_row-1, ws.ws_col}; if (char* csr = tigetstr((char*)"csr")) - putp(csr); + putp(tiparm(csr, 0, ws.ws_row)); if (menu) { @@ -937,16 +938,17 @@ void NCursesUI::enable_mouse(bool enabled) mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, nullptr); mouseinterval(0); // force enable report mouse position - puts("\033[?1002h"); + fputs(stdout, "\033[?1002h"); // force enable report focus events - puts("\033[?1004h"); + fputs(stdout, "\033[?1004h"); } else { mousemask(0, nullptr); - puts("\033[?1004l"); - puts("\033[?1002l"); + fputs(stdout, "\033[?1004l"); + fputs(stdout, "\033[?1002l"); } + fflush(stdout); } void NCursesUI::set_ui_options(const Options& options) |
