summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-02 00:34:05 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-02 00:34:05 +0800
commit8c49555a1861b32024b35e4a89b4b696107e3c48 (patch)
tree141c795e5dc22bde1093fd73126c9d42f89927f7
parentad7e4f44a6042c7aef543f3c3a872e613e5cee0d (diff)
downloadpttbbs-8c49555a1861b32024b35e4a89b4b696107e3c48.tar
pttbbs-8c49555a1861b32024b35e4a89b4b696107e3c48.tar.gz
pttbbs-8c49555a1861b32024b35e4a89b4b696107e3c48.tar.bz2
pttbbs-8c49555a1861b32024b35e4a89b4b696107e3c48.tar.lz
pttbbs-8c49555a1861b32024b35e4a89b4b696107e3c48.tar.xz
pttbbs-8c49555a1861b32024b35e4a89b4b696107e3c48.tar.zst
pttbbs-8c49555a1861b32024b35e4a89b4b696107e3c48.zip
- pfterm: fix TAB behavior
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3769 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/pfterm.c13
1 files changed, 10 insertions, 3 deletions
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')
{