summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-06-11 13:49:13 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-06-11 13:49:13 +0800
commit057c5139c7cfa51ab0cbba3619e90e799da2daa5 (patch)
tree69259736c780d8fad47e7fa91d7803f512174337 /mbbsd
parent6fe24d67db90d311f0c127aea6fd0f218b3a15c9 (diff)
downloadpttbbs-057c5139c7cfa51ab0cbba3619e90e799da2daa5.tar
pttbbs-057c5139c7cfa51ab0cbba3619e90e799da2daa5.tar.gz
pttbbs-057c5139c7cfa51ab0cbba3619e90e799da2daa5.tar.bz2
pttbbs-057c5139c7cfa51ab0cbba3619e90e799da2daa5.tar.lz
pttbbs-057c5139c7cfa51ab0cbba3619e90e799da2daa5.tar.xz
pttbbs-057c5139c7cfa51ab0cbba3619e90e799da2daa5.tar.zst
pttbbs-057c5139c7cfa51ab0cbba3619e90e799da2daa5.zip
Handle tabs in outc()
Fix buffer offset off by 1 git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4345 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/screen.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index fabef4b2..5537a4f3 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -505,6 +505,22 @@ outc(unsigned char c)
if (c == 0xFF || c == 0x00)
return;
+ if (c == '\t') {
+ int x, y;
+
+ getyx_ansi(&y, &x);
+
+ if (x % 8 == 0)
+ i = 8;
+ else
+ i = 8 - (x % 8);
+
+ for (;i > 0; i--)
+ outc(' ');
+
+ return;
+ }
+
if (c == '\n' || c == '\r') {
if (standing) {
slp->eso = MAX(slp->eso, cur_col);
@@ -680,7 +696,7 @@ innstr(char *str, int n)
return 0;
slp->data[slp->len] = 0;
strip_ansi(buf, (char*)slp->data, STRIP_ALL);
- buf[ANSILINELEN] = 0;
+ buf[ANSILINELEN-1] = 0;
strlcpy(str, buf, n);
return strlen(str);
}