From owner-p4-projects@FreeBSD.ORG Thu Dec 25 15:20:31 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 65BCC106568B; Thu, 25 Dec 2008 15:20:31 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 247041065689 for ; Thu, 25 Dec 2008 15:20:31 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 131698FC14 for ; Thu, 25 Dec 2008 15:20:31 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mBPFKUPJ036884 for ; Thu, 25 Dec 2008 15:20:30 GMT (envelope-from ed@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mBPFKUft036882 for perforce@freebsd.org; Thu, 25 Dec 2008 15:20:30 GMT (envelope-from ed@FreeBSD.org) Date: Thu, 25 Dec 2008 15:20:30 GMT Message-Id: <200812251520.mBPFKUft036882@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ed@FreeBSD.org using -f From: Ed Schouten To: Perforce Change Reviews Cc: Subject: PERFORCE change 155277 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Dec 2008 15:20:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=155277 Change 155277 by ed@ed_dull on 2008/12/25 15:19:56 It seems my insert mode fixes were not sufficient. If line wrapping occurs, it overwrites the first character on the next line, while it should move the entire line one character. Affected files ... .. //depot/projects/mpsafetty/sys/dev/syscons/teken/teken_subr.h#18 edit Differences ... ==== //depot/projects/mpsafetty/sys/dev/syscons/teken/teken_subr.h#18 (text+ko) ==== @@ -665,6 +665,28 @@ } static void +teken_subr_do_putchar(teken_t *t, const teken_pos_t *tp, teken_char_t c, + int width) +{ + + if (t->t_stateflags & TS_INSERT && + tp->tp_col < t->t_winsize.tp_col - width) { + teken_rect_t ctr; + teken_pos_t ctp; + + /* Insert mode. Move existing characters to the right. */ + ctr.tr_begin = *tp; + ctr.tr_end.tp_row = tp->tp_row + 1; + ctr.tr_end.tp_col = t->t_winsize.tp_col - width; + ctp.tp_row = tp->tp_row; + ctp.tp_col = tp->tp_col + width; + teken_funcs_copy(t, &ctr, &ctp); + } + + teken_funcs_putchar(t, tp, c, &t->t_curattr); +} + +static void teken_subr_regular_character(teken_t *t, teken_char_t c) { int width; @@ -674,25 +696,13 @@ if (width <= 0) return; - if (t->t_stateflags & TS_INSERT && - t->t_cursor.tp_col < t->t_winsize.tp_col - width) { - teken_rect_t tr; - teken_pos_t tp; - - /* Insert mode. Move existing characters to the right. */ - tr.tr_begin = t->t_cursor; - tr.tr_end.tp_row = t->t_cursor.tp_row + 1; - tr.tr_end.tp_col = t->t_winsize.tp_col - width; - tp.tp_row = t->t_cursor.tp_row; - tp.tp_col = t->t_cursor.tp_col + width; - teken_funcs_copy(t, &tr, &tp); - } - if (t->t_cursor.tp_col == t->t_winsize.tp_col - 1 && (t->t_stateflags & (TS_WRAPPED|TS_AUTOWRAP)) == (TS_WRAPPED|TS_AUTOWRAP)) { teken_pos_t tp; + /* Perform line wrapping. */ + if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) { /* Perform scrolling. */ teken_subr_do_scroll(t, 1); @@ -701,25 +711,32 @@ /* No scrolling needed. */ tp.tp_row = t->t_cursor.tp_row + 1; if (tp.tp_row == t->t_winsize.tp_row) { - teken_funcs_putchar(t, &t->t_cursor, c, - &t->t_curattr); + /* + * Corner case: regular character + * outside scrolling region, but at the + * bottom of the screen. + */ + teken_subr_do_putchar(t, &t->t_cursor, + c, width); return; } } tp.tp_col = 0; - teken_funcs_putchar(t, &tp, c, &t->t_curattr); + teken_subr_do_putchar(t, &tp, c, width); t->t_cursor.tp_row = tp.tp_row; t->t_cursor.tp_col = width; t->t_stateflags &= ~TS_WRAPPED; } else { - /* No scrolling needed. */ - teken_funcs_putchar(t, &t->t_cursor, c, &t->t_curattr); - if (t->t_cursor.tp_col >= t->t_winsize.tp_col - width) { + /* No line wrapping needed. */ + 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) { t->t_stateflags |= TS_WRAPPED; + t->t_cursor.tp_col = t->t_winsize.tp_col - 1; } else { - t->t_cursor.tp_col += width; t->t_stateflags &= ~TS_WRAPPED; } }