diff options
author | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2014-11-01 17:05:15 +0000 |
---|---|---|
committer | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2014-11-01 17:05:15 +0000 |
commit | da49f6bcc30fd49efe11a3fd228bf94480a1b4b9 (patch) | |
tree | de2db3fcc80adf0d399fede8bc0d5457dc4e2075 | |
parent | 0677dfd1c4dadb62482e2c72fa4c6720902128a4 (diff) |
Notes
-rw-r--r-- | sys/dev/vt/vt_buf.c | 12 | ||||
-rw-r--r-- | sys/dev/vt/vt_core.c | 1 | ||||
-rw-r--r-- | sys/kern/subr_terminal.c | 7 | ||||
-rw-r--r-- | sys/sys/terminal.h | 1 |
4 files changed, 21 insertions, 0 deletions
diff --git a/sys/dev/vt/vt_buf.c b/sys/dev/vt/vt_buf.c index cc23b3b6c99b..c3e639e8c58a 100644 --- a/sys/dev/vt/vt_buf.c +++ b/sys/dev/vt/vt_buf.c @@ -562,6 +562,18 @@ vtbuf_grow(struct vt_buf *vb, const term_pos_t *p, unsigned int history_size) vb->vb_roffset = vb->vb_curroffset; } + /* Adjust cursor position. */ + if (vb->vb_cursor.tp_col > p->tp_col - 1) + /* + * Move cursor to the last column, in case its previous + * position is outside of the new screen area. + */ + vb->vb_cursor.tp_col = p->tp_col - 1; + + if (vb->vb_curroffset > 0 || vb->vb_cursor.tp_row > p->tp_row - 1) + /* Move cursor to the last line on the screen. */ + vb->vb_cursor.tp_row = p->tp_row - 1; + vtbuf_make_undirty(vb); VTBUF_UNLOCK(vb); diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 8c7d0f0e5e8e..0062b0e6da75 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -1532,6 +1532,7 @@ vt_change_font(struct vt_window *vw, struct vt_font *vf) terminal_mute(tm, 1); vtbuf_grow(&vw->vw_buf, &size, vw->vw_buf.vb_history_size); terminal_set_winsize_blank(tm, &wsz, 0, NULL); + terminal_set_cursor(tm, &vw->vw_buf.vb_cursor); terminal_mute(tm, 0); /* Actually apply the font to the current window. */ diff --git a/sys/kern/subr_terminal.c b/sys/kern/subr_terminal.c index 69345df56ca6..76c6cfbf6453 100644 --- a/sys/kern/subr_terminal.c +++ b/sys/kern/subr_terminal.c @@ -190,6 +190,13 @@ terminal_maketty(struct terminal *tm, const char *fmt, ...) } void +terminal_set_cursor(struct terminal *tm, const term_pos_t *pos) +{ + + teken_set_cursor(&tm->tm_emulator, pos); +} + +void terminal_set_winsize_blank(struct terminal *tm, const struct winsize *size, int blank, const term_attr_t *attr) { diff --git a/sys/sys/terminal.h b/sys/sys/terminal.h index 133332f4b944..6528558a8608 100644 --- a/sys/sys/terminal.h +++ b/sys/sys/terminal.h @@ -207,6 +207,7 @@ struct terminal { struct terminal *terminal_alloc(const struct terminal_class *tc, void *softc); void terminal_maketty(struct terminal *tm, const char *fmt, ...); +void terminal_set_cursor(struct terminal *tm, const term_pos_t *pos); void terminal_set_winsize_blank(struct terminal *tm, const struct winsize *size, int blank, const term_attr_t *attr); void terminal_set_winsize(struct terminal *tm, const struct winsize *size); |