diff options
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/syscons/teken/teken.c | 4 | ||||
| -rw-r--r-- | sys/dev/syscons/teken/teken.h | 2 | ||||
| -rw-r--r-- | sys/dev/syscons/teken/teken_demo.c | 4 | ||||
| -rw-r--r-- | sys/dev/syscons/teken/teken_subr.h | 26 |
4 files changed, 34 insertions, 2 deletions
diff --git a/sys/dev/syscons/teken/teken.c b/sys/dev/syscons/teken/teken.c index e1efcf745303..acf35f7635e7 100644 --- a/sys/dev/syscons/teken/teken.c +++ b/sys/dev/syscons/teken/teken.c @@ -68,7 +68,11 @@ teken_wcwidth(teken_char_t c) #define TS_INSERT 0x02 /* Insert mode. */ #define TS_AUTOWRAP 0x04 /* Autowrap. */ #define TS_ORIGIN 0x08 /* Origin mode. */ +#ifdef TEKEN_CONS25 +#define TS_WRAPPED 0x00 /* Simple line wrapping. */ +#else /* !TEKEN_CONS25 */ #define TS_WRAPPED 0x10 /* Next character should be printed on col 0. */ +#endif /* TEKEN_CONS25 */ /* Character that blanks a cell. */ #define BLANK ' ' diff --git a/sys/dev/syscons/teken/teken.h b/sys/dev/syscons/teken/teken.h index ef107cac076f..61c8afe74a57 100644 --- a/sys/dev/syscons/teken/teken.h +++ b/sys/dev/syscons/teken/teken.h @@ -43,6 +43,8 @@ */ #define TEKEN_UTF8 #endif +/* Emulate cons25-like behaviour. */ +#define TEKEN_CONS25 #ifdef TEKEN_UTF8 typedef uint32_t teken_char_t; diff --git a/sys/dev/syscons/teken/teken_demo.c b/sys/dev/syscons/teken/teken_demo.c index 7d01f9b50ee3..74b4321ae7e8 100644 --- a/sys/dev/syscons/teken/teken_demo.c +++ b/sys/dev/syscons/teken/teken_demo.c @@ -70,7 +70,7 @@ struct pixel { }; #define NCOLS 80 -#define NROWS 24 +#define NROWS 25 struct pixel buffer[NCOLS][NROWS]; static int ptfd; @@ -279,7 +279,7 @@ main(int argc __unused, char *argv[] __unused) perror("forkpty"); exit(1); case 0: - setenv("TERM", "xterm-color", 1); + setenv("TERM", "cons25", 1); setenv("LC_CTYPE", "UTF-8", 0); execlp("zsh", "-zsh", NULL); execlp("bash", "-bash", NULL); diff --git a/sys/dev/syscons/teken/teken_subr.h b/sys/dev/syscons/teken/teken_subr.h index 53aea0aa476c..d8319f676f01 100644 --- a/sys/dev/syscons/teken/teken_subr.h +++ b/sys/dev/syscons/teken/teken_subr.h @@ -250,6 +250,8 @@ teken_subr_cursor_backward_tabulation(teken_t *t, unsigned int ntabs) if (teken_tab_isset(t, t->t_cursor.tp_col)) ntabs--; } while (ntabs > 0); + + teken_funcs_cursor(t); } static void @@ -291,6 +293,8 @@ teken_subr_cursor_forward_tabulation(teken_t *t, unsigned int ntabs) if (teken_tab_isset(t, t->t_cursor.tp_col)) ntabs--; } while (ntabs > 0); + + teken_funcs_cursor(t); } static void @@ -527,6 +531,10 @@ teken_subr_horizontal_position_absolute(teken_t *t, unsigned int col) static void teken_subr_horizontal_tab(teken_t *t) { +#ifdef TEKEN_CONS25 + + teken_subr_cursor_forward_tabulation(t, 1); +#else /* !TEKEN_CONS25 */ teken_rect_t tr; tr.tr_begin = t->t_cursor; @@ -537,6 +545,7 @@ teken_subr_horizontal_tab(teken_t *t) /* Blank region that we skipped. */ if (tr.tr_end.tp_col > tr.tr_begin.tp_col) teken_funcs_fill(t, &tr, BLANK, &t->t_curattr); +#endif /* TEKEN_CONS25 */ } static void @@ -708,6 +717,22 @@ teken_subr_regular_character(teken_t *t, teken_char_t c) if (width <= 0) return; +#ifdef TEKEN_CONS25 + teken_subr_do_putchar(t, &t->t_cursor, c, width); + t->t_cursor.tp_col += width; + + if (t->t_cursor.tp_col >= t->t_winsize.tp_col) { + if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) { + /* Perform scrolling. */ + teken_subr_do_scroll(t, 1); + } else { + /* No scrolling needed. */ + if (t->t_cursor.tp_row < t->t_winsize.tp_row - 1) + t->t_cursor.tp_row++; + } + t->t_cursor.tp_col = 0; + } +#else /* !TEKEN_CONS25 */ if (t->t_cursor.tp_col == t->t_winsize.tp_col - 1 && (t->t_stateflags & (TS_WRAPPED|TS_AUTOWRAP)) == (TS_WRAPPED|TS_AUTOWRAP)) { @@ -752,6 +777,7 @@ teken_subr_regular_character(teken_t *t, teken_char_t c) t->t_stateflags &= ~TS_WRAPPED; } } +#endif /* TEKEN_CONS25 */ teken_funcs_cursor(t); } |
