PERFORCE change 155277 for review
Ed Schouten
ed at FreeBSD.org
Thu Dec 25 07:20:31 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=155277
Change 155277 by ed at 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;
}
}
More information about the p4-projects
mailing list