Skip to content
Snippets Groups Projects
Commit 403d147e authored by Axel Naumann's avatar Axel Naumann
Browse files

From Roman Zulak: Flush stdout less (textinput part).

parent cba419cd
Branches
Tags
No related merge requests found
...@@ -124,14 +124,13 @@ namespace textinput { ...@@ -124,14 +124,13 @@ namespace textinput {
} }
} }
static void syncOut(int /*fd*/) { // Don't rely on flushing here.
::fflush(stdout); #define SYNC_OUT(fd) /*if (fd==STDOUT_FILENO) { ::fflush(stdout); } }*/
}
TerminalDisplayUnix::~TerminalDisplayUnix() { TerminalDisplayUnix::~TerminalDisplayUnix() {
Detach(); Detach();
if (fOutputID != STDOUT_FILENO) { if (fOutputID != STDOUT_FILENO) {
syncOut(fOutputID); SYNC_OUT(fOutputID);
::close(fOutputID); ::close(fOutputID);
} }
} }
...@@ -280,7 +279,7 @@ namespace textinput { ...@@ -280,7 +279,7 @@ namespace textinput {
TerminalDisplayUnix::Attach() { TerminalDisplayUnix::Attach() {
// set to noecho // set to noecho
if (fIsAttached) return; if (fIsAttached) return;
syncOut(fOutputID); SYNC_OUT(fOutputID);
TerminalConfigUnix::Get().Attach(); TerminalConfigUnix::Get().Attach();
fWritePos = Pos(); fWritePos = Pos();
fWriteLen = 0; fWriteLen = 0;
...@@ -290,7 +289,7 @@ namespace textinput { ...@@ -290,7 +289,7 @@ namespace textinput {
void void
TerminalDisplayUnix::Detach() { TerminalDisplayUnix::Detach() {
if (!fIsAttached) return; if (!fIsAttached) return;
syncOut(fOutputID); SYNC_OUT(fOutputID);
TerminalConfigUnix::Get().Detach(); TerminalConfigUnix::Get().Detach();
TerminalDisplay::Detach(); TerminalDisplay::Detach();
fIsAttached = false; fIsAttached = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment