Import yet some more small fixes to libteken sources:

- Implement NP (ASCII 12, Form Feed). When used with cons25, it should
  clear the screen and place the cursor at the top of the screen. When
  used with xterm, it should just simulate a newline.

- When we want to use xterm emulation, make teken_demo set TERM to
  xterm.

Spotted by:	Paul B. Mahol <onemda@gmail.com>
This commit is contained in:
Ed Schouten 2009-01-05 22:09:46 +00:00
parent 6811e5d474
commit 2056b4c79b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=186798
3 changed files with 25 additions and 0 deletions

View File

@ -226,6 +226,9 @@ teken_input_char(teken_t *t, teken_char_t c)
case '\x0B':
teken_subr_newline(t);
break;
case '\x0C':
teken_subr_newpage(t);
break;
case '\r':
teken_subr_carriage_return(t);
break;

View File

@ -279,7 +279,11 @@ main(int argc __unused, char *argv[] __unused)
perror("forkpty");
exit(1);
case 0:
#ifdef TEKEN_CONS25
setenv("TERM", "cons25", 1);
#else /* !TEKEN_CONS25 */
setenv("TERM", "xterm", 1);
#endif /* TEKEN_CONS25 */
#ifdef TEKEN_UTF8
setenv("LC_CTYPE", "UTF-8", 0);
#endif /* TEKEN_UTF8 */

View File

@ -661,6 +661,24 @@ teken_subr_newline(teken_t *t)
teken_funcs_cursor(t);
}
static void
teken_subr_newpage(teken_t *t)
{
#ifdef TEKEN_CONS25
teken_rect_t tr;
tr.tr_begin.tp_row = tr.tr_begin.tp_col = 0;
tr.tr_end = t->t_winsize;
teken_funcs_fill(t, &tr, BLANK, &t->t_curattr);
t->t_cursor.tp_row = t->t_cursor.tp_col = 0;
teken_funcs_cursor(t);
#else /* !TEKEN_CONS25 */
teken_subr_newline(t);
#endif /* TEKEN_CONS25 */
}
static void
teken_subr_next_line(teken_t *t)
{