From 8c49555a1861b32024b35e4a89b4b696107e3c48 Mon Sep 17 00:00:00 2001 From: piaip Date: Tue, 1 Jan 2008 16:34:05 +0000 Subject: - pfterm: fix TAB behavior git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3769 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/pfterm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'mbbsd/pfterm.c') diff --git a/mbbsd/pfterm.c b/mbbsd/pfterm.c index 162e2459..d727467d 100644 --- a/mbbsd/pfterm.c +++ b/mbbsd/pfterm.c @@ -1049,13 +1049,20 @@ outc(unsigned char c) } else if (c == '\t') { - // tab: move by 8 + // tab: move by 8, and erase the moved range int x = ft.x; if (x % 8 == 0) x += 8; else - x += (8-x); - ft.x = ranged(x, 0, ft.rows-1); + x += (8-(x%8)); + x = ranged(x, 0, ft.rows-1); + // erase the characters between + if (x > ft.x) + { + memset(FTCROW+ft.x, FTCHAR_ERASE, x - ft.x); + memset(FTAROW+ft.x, ft.attr, x-ft.x); + } + ft.x = x; } else if (c == '\b') { -- cgit v1.2.3