fix prompting vs buffering outside readline
This commit is contained in:
parent
f99d048cc2
commit
8ad14f6765
10
os/console.c
10
os/console.c
@ -44,13 +44,10 @@ static int ConsolePutc(int, int);
|
||||
|
||||
bool Yap_DoPrompt(StreamDesc *s) {
|
||||
if (s->status & Tty_Stream_f) {
|
||||
if (GLOBAL_Stream[0].status & Tty_Stream_f &&
|
||||
s->name == GLOBAL_Stream[0].name &&
|
||||
((GLOBAL_Stream[1].status & Tty_Stream_f ||
|
||||
s->name == GLOBAL_Stream[1].name) ||
|
||||
(GLOBAL_Stream[2].status & Tty_Stream_f &&
|
||||
s->name == GLOBAL_Stream[2].name)))
|
||||
if (GLOBAL_Stream[StdInStream].status & Tty_Stream_f &&
|
||||
GLOBAL_Stream[StdErrStream].status & Tty_Stream_f) {
|
||||
return LOCAL_newline;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -149,6 +146,7 @@ restart:
|
||||
GLOBAL_Stream[StdErrStream].stream_putc(StdErrStream, ch);
|
||||
}
|
||||
}
|
||||
Yap_clearInput(StdErrStream);
|
||||
strncpy(LOCAL_Prompt, (char *)RepAtom(LOCAL_AtPrompt)->StrOfAE, MAX_PROMPT);
|
||||
LOCAL_newline = FALSE;
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ Int Yap_CloseSocket(int, socket_info, socket_domain);
|
||||
|
||||
#endif /* USE_SOCKET */
|
||||
|
||||
extern bool Yap_clearInput(int sno);
|
||||
extern Term Yap_read_term(int inp_stream, Term opts, bool clauatse);
|
||||
extern Term Yap_Parse(UInt prio, encoding_t enc, Term cmod);
|
||||
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user