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;
|
return TCL_OK;
|
||||||
|
|
||||||
magicfatal:
|
magicfatal:
|
||||||
TxResetTerminal();
|
TxResetTerminal(FALSE);
|
||||||
Tcl_SetResult(interp, "Magic initialization encountered a fatal error.", NULL);
|
Tcl_SetResult(interp, "Magic initialization encountered a fatal error.", NULL);
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
@ -780,7 +780,7 @@ _magic_startup(ClientData clientData,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
TxResetTerminal();
|
TxResetTerminal(FALSE);
|
||||||
|
|
||||||
if (TxTkConsole)
|
if (TxTkConsole)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ extern void TxReprint();
|
||||||
|
|
||||||
/* terminal-state procedures */
|
/* terminal-state procedures */
|
||||||
extern void TxSetTerminal();
|
extern void TxSetTerminal();
|
||||||
extern void TxResetTerminal();
|
extern void TxResetTerminal(bool force);
|
||||||
extern char TxEOFChar; /* The current EOF character */
|
extern char TxEOFChar; /* The current EOF character */
|
||||||
extern char TxInterruptChar; /* The current interrupt character */
|
extern char TxInterruptChar; /* The current interrupt character */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1004,7 +1004,7 @@ TxGetLineWPrompt(dest, maxChars, prompt, prefix)
|
||||||
txReprint1 = NULL;
|
txReprint1 = NULL;
|
||||||
#else
|
#else
|
||||||
_rl_prefix = prefix;
|
_rl_prefix = prefix;
|
||||||
TxResetTerminal ();
|
TxResetTerminal (FALSE);
|
||||||
|
|
||||||
if (prompt != NULL) {
|
if (prompt != NULL) {
|
||||||
res = readline (prompt);
|
res = readline (prompt);
|
||||||
|
|
@ -1427,6 +1427,9 @@ TxSetTerminal()
|
||||||
*
|
*
|
||||||
* Returns the terminal to the way it was when Magic started up.
|
* 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:
|
* Results:
|
||||||
* none.
|
* none.
|
||||||
*
|
*
|
||||||
|
|
@ -1436,13 +1439,12 @@ TxSetTerminal()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
TxResetTerminal()
|
TxResetTerminal(bool force)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
/* If using Tk console, don't mess with the terminal settings; */
|
/* If using Tk console, don't mess with the terminal settings; */
|
||||||
/* Otherwise, this prevents running magic in the terminal background. */
|
/* Otherwise, this prevents running magic in the terminal background. */
|
||||||
if (TxTkConsole) return;
|
if (TxTkConsole && !force) return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (TxStdinIsatty && haveCloseState) txSetTermState(&closeTermState);
|
if (TxStdinIsatty && haveCloseState) txSetTermState(&closeTermState);
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ MainExit(errNum)
|
||||||
DBRemoveBackup();
|
DBRemoveBackup();
|
||||||
|
|
||||||
TxFlush();
|
TxFlush();
|
||||||
TxResetTerminal();
|
TxResetTerminal(FALSE); /* set also atexit() handler */
|
||||||
|
|
||||||
#ifdef MAGIC_WRAPPER
|
#ifdef MAGIC_WRAPPER
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ sigRetVal
|
||||||
sigOnStop(int signo)
|
sigOnStop(int signo)
|
||||||
{
|
{
|
||||||
/* fix things up */
|
/* fix things up */
|
||||||
TxResetTerminal();
|
TxResetTerminal(TRUE);
|
||||||
GrStop();
|
GrStop();
|
||||||
|
|
||||||
/* restore the default action and resend the signal */
|
/* restore the default action and resend the signal */
|
||||||
|
|
@ -565,7 +565,7 @@ sigCrash(signum)
|
||||||
strcpy(AbortMessage, msg);
|
strcpy(AbortMessage, msg);
|
||||||
AbortFatal = TRUE;
|
AbortFatal = TRUE;
|
||||||
niceabort();
|
niceabort();
|
||||||
TxResetTerminal();
|
TxResetTerminal(TRUE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (magicNumber == 1239987) {
|
if (magicNumber == 1239987) {
|
||||||
|
|
@ -585,7 +585,7 @@ sigCrash(signum)
|
||||||
strcpy(AbortMessage, msg);
|
strcpy(AbortMessage, msg);
|
||||||
AbortFatal = TRUE;
|
AbortFatal = TRUE;
|
||||||
niceabort();
|
niceabort();
|
||||||
TxResetTerminal();
|
TxResetTerminal(TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue