TCL9: TxResetTerminal(bool force) added arguments
This seems like it has 2 use cases. Internal console management around reprinting command prompt, but many modes of operation delegate the prompt processing to tkcon or readline. Process termination to restore the termios.
This commit is contained in:
parent
c339e9b845
commit
272dda3c84
|
|
@ -634,7 +634,7 @@ _magic_initialize(ClientData clientData,
|
|||
return TCL_OK;
|
||||
|
||||
magicfatal:
|
||||
TxResetTerminal();
|
||||
TxResetTerminal(FALSE);
|
||||
Tcl_SetResult(interp, "Magic initialization encountered a fatal error.", NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
|
@ -780,7 +780,7 @@ _magic_startup(ClientData clientData,
|
|||
NULL);
|
||||
}
|
||||
|
||||
TxResetTerminal();
|
||||
TxResetTerminal(FALSE);
|
||||
|
||||
if (TxTkConsole)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ extern void TxReprint();
|
|||
|
||||
/* terminal-state procedures */
|
||||
extern void TxSetTerminal();
|
||||
extern void TxResetTerminal();
|
||||
extern void TxResetTerminal(bool force);
|
||||
extern char TxEOFChar; /* The current EOF character */
|
||||
extern char TxInterruptChar; /* The current interrupt character */
|
||||
|
||||
|
|
|
|||
|
|
@ -1004,7 +1004,7 @@ TxGetLineWPrompt(dest, maxChars, prompt, prefix)
|
|||
txReprint1 = NULL;
|
||||
#else
|
||||
_rl_prefix = prefix;
|
||||
TxResetTerminal ();
|
||||
TxResetTerminal (FALSE);
|
||||
|
||||
if (prompt != NULL) {
|
||||
res = readline (prompt);
|
||||
|
|
@ -1427,6 +1427,9 @@ TxSetTerminal()
|
|||
*
|
||||
* Returns the terminal to the way it was when Magic started up.
|
||||
*
|
||||
* 'force' maybe set for atexit() restoration, when the console
|
||||
* input handler is no longer in effect. Also crash handling, SIGSTOP.
|
||||
*
|
||||
* Results:
|
||||
* none.
|
||||
*
|
||||
|
|
@ -1436,13 +1439,12 @@ TxSetTerminal()
|
|||
*/
|
||||
|
||||
void
|
||||
TxResetTerminal()
|
||||
TxResetTerminal(bool force)
|
||||
{
|
||||
|
||||
#ifdef MAGIC_WRAPPER
|
||||
/* If using Tk console, don't mess with the terminal settings; */
|
||||
/* Otherwise, this prevents running magic in the terminal background. */
|
||||
if (TxTkConsole) return;
|
||||
if (TxTkConsole && !force) return;
|
||||
#endif
|
||||
|
||||
if (TxStdinIsatty && haveCloseState) txSetTermState(&closeTermState);
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ MainExit(errNum)
|
|||
DBRemoveBackup();
|
||||
|
||||
TxFlush();
|
||||
TxResetTerminal();
|
||||
TxResetTerminal(FALSE); /* set also atexit() handler */
|
||||
|
||||
#ifdef MAGIC_WRAPPER
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ sigRetVal
|
|||
sigOnStop(int signo)
|
||||
{
|
||||
/* fix things up */
|
||||
TxResetTerminal();
|
||||
TxResetTerminal(TRUE);
|
||||
GrStop();
|
||||
|
||||
/* restore the default action and resend the signal */
|
||||
|
|
@ -565,7 +565,7 @@ sigCrash(signum)
|
|||
strcpy(AbortMessage, msg);
|
||||
AbortFatal = TRUE;
|
||||
niceabort();
|
||||
TxResetTerminal();
|
||||
TxResetTerminal(TRUE);
|
||||
}
|
||||
#else
|
||||
if (magicNumber == 1239987) {
|
||||
|
|
@ -585,7 +585,7 @@ sigCrash(signum)
|
|||
strcpy(AbortMessage, msg);
|
||||
AbortFatal = TRUE;
|
||||
niceabort();
|
||||
TxResetTerminal();
|
||||
TxResetTerminal(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue