From 48cb8baf4e3df5d263c87fc152fdf38dc9e6e439 Mon Sep 17 00:00:00 2001 From: piaip Date: Thu, 10 Jan 2008 06:44:50 +0000 Subject: - pfterm: handle X position better. warning: \n at eol (>=cols) will now create one blank line. such case should be handled by pager, not terminal system. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3813 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/pfterm.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/pfterm.c b/mbbsd/pfterm.c index 88a2b2b4..701ef21e 100644 --- a/mbbsd/pfterm.c +++ b/mbbsd/pfterm.c @@ -940,11 +940,8 @@ getmaxyx(int *y, int *x) void move(int y, int x) { - y = ranged(y, 0, ft.rows-1); - x = ranged(x, 0, ft.cols-1); - - ft.y = y; - ft.x = x; + ft.y = ranged(y, 0, ft.rows-1); + ft.x = ranged(x, 0, ft.cols-1); } // scrolling @@ -1183,6 +1180,15 @@ outc(unsigned char c) } else // normal characters { + assert (ft.x >= 0 && ft.x < ft.cols); + + // normal characters + FTC = c; +#ifdef FTATTR_TRANSPARENT + if (ft.attr != FTATTR_TRANSPARENT) +#endif // FTATTR_TRANSPARENT + FTA = ft.attr; + // XXX allow x == ft.cols? if (ft.x >= ft.cols) { @@ -1196,17 +1202,6 @@ outc(unsigned char c) ft.y --; } } - - // normal characters - FTC = c; -#ifdef FTATTR_TRANSPARENT - if (ft.attr != FTATTR_TRANSPARENT) -#endif // FTATTR_TRANSPARENT - FTA = ft.attr; - ft.x ++; - - // we must carefully deal x here. - ft.x = ranged(ft.x, 0, ft.cols-1); } } -- cgit v1.2.3