From 2056b4c79b951a166d6bf6a9a721d159172a5b3e Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Mon, 5 Jan 2009 22:09:46 +0000 Subject: 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 --- sys/dev/syscons/teken/teken.c | 3 +++ sys/dev/syscons/teken/teken_demo.c | 4 ++++ sys/dev/syscons/teken/teken_subr.h | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+) (limited to 'sys/dev/syscons') diff --git a/sys/dev/syscons/teken/teken.c b/sys/dev/syscons/teken/teken.c index b3c8bd42592d..62ded2741b96 100644 --- a/sys/dev/syscons/teken/teken.c +++ b/sys/dev/syscons/teken/teken.c @@ -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; diff --git a/sys/dev/syscons/teken/teken_demo.c b/sys/dev/syscons/teken/teken_demo.c index acea4f7f099e..2d0a4bf3ad51 100644 --- a/sys/dev/syscons/teken/teken_demo.c +++ b/sys/dev/syscons/teken/teken_demo.c @@ -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 */ diff --git a/sys/dev/syscons/teken/teken_subr.h b/sys/dev/syscons/teken/teken_subr.h index 328858640b94..f26dc890d7a0 100644 --- a/sys/dev/syscons/teken/teken_subr.h +++ b/sys/dev/syscons/teken/teken_subr.h @@ -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) { -- cgit v1.3