fix prompting vs buffering outside readline

This commit is contained in:
Vitor Santos Costa
2017-07-30 22:23:16 +01:00
parent f99d048cc2
commit 8ad14f6765
3 changed files with 11 additions and 9 deletions

View File

@@ -154,7 +154,7 @@ int Yap_GetFreeStreamD(void) { return GetFreeStreamD(); }
/**
*
*/
static bool clearInput(int sno)
bool Yap_clearInput(int sno)
{
if (!(GLOBAL_Stream[sno].status & Tty_Stream_f))
return true;
@@ -162,7 +162,10 @@ int Yap_GetFreeStreamD(void) { return GetFreeStreamD(); }
if (GLOBAL_Stream[sno].status & Readline_Stream_f)
return Yap_readline_clear_pending_input (GLOBAL_Stream+sno);
#endif
#if HAVE_TCFLUSH
#if HAVE_FPURGE
fflush(NULL);
return fpurge( GLOBAL_Stream[sno].file ) == 0;
#elif HAVE_TCFLUSH
return tcflush(fileno(GLOBAL_Stream[sno].file), TCIOFLUSH) == 0;
#elif MSC_VER
return fflush(GLOBAL_Stream[sno].file) == 0;
@@ -176,7 +179,7 @@ static Int clear_input( USES_REGS1 )
"clear_input/1");
if (sno != -1)
UNLOCK(GLOBAL_Stream[sno].streamlock);
return clearInput(sno);
return Yap_clearInput(sno);
}
static Term lineCount(int sno) {