Fix curses bug: garbled output in nl mode.
Use nonl mode in sl, as more efficient.
This commit is contained in:
@@ -90,6 +90,7 @@ int main(int argc, char *argv[])
|
||||
initscr();
|
||||
signal(SIGINT, SIG_IGN);
|
||||
noecho();
|
||||
nonl();
|
||||
leaveok(stdscr, TRUE);
|
||||
scrollok(stdscr, FALSE);
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ plod(cnt)
|
||||
* If we will later need a \n which will turn into a \r\n by
|
||||
* the system or the terminal, then don't bother to try to \r.
|
||||
*/
|
||||
if ((NONL || !_pfast) && outline < destline)
|
||||
if (!_pfast && outline < destline)
|
||||
goto dontcr;
|
||||
/*
|
||||
* If the terminal will do a \r\n and there isn't room for it,
|
||||
@@ -195,12 +195,13 @@ dontcr:
|
||||
outline++;
|
||||
if (NL)
|
||||
tputs(NL, 0, plodput);
|
||||
else
|
||||
plodput('\n');
|
||||
else {
|
||||
plodput('\n');
|
||||
if (!_pfast)
|
||||
outcol = 0;
|
||||
}
|
||||
if (plodcnt < 0)
|
||||
goto out;
|
||||
if (NONL || _pfast == 0)
|
||||
outcol = 0;
|
||||
}
|
||||
if (BT)
|
||||
k = strlen(BT);
|
||||
@@ -271,7 +272,7 @@ dontcr:
|
||||
}
|
||||
else
|
||||
nondes:
|
||||
if (ND)
|
||||
if (ND)
|
||||
tputs(ND, 0, plodput);
|
||||
else
|
||||
plodput(' ');
|
||||
|
||||
@@ -52,6 +52,7 @@ gettmode()
|
||||
_res_flg = _tty.sg_flags;
|
||||
GT = ((_tty.sg_flags & XTABS) == 0);
|
||||
NONL = ((_tty.sg_flags & CRMOD) == 0);
|
||||
_pfast = NONL;
|
||||
_tty.sg_flags &= ~XTABS;
|
||||
ioctl(_tty_ch, TIOCSETP, &_tty);
|
||||
# ifdef DEBUG
|
||||
@@ -59,8 +60,6 @@ gettmode()
|
||||
fprintf(outf, "GETTMODE: NONL = %s\n", NONL ? "TRUE" : "FALSE");
|
||||
fprintf(outf, "GETTMODE: ospeed = %d\n", ospeed);
|
||||
# endif
|
||||
/* Use nonl mode by default. */
|
||||
nonl();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user