summaryrefslogtreecommitdiffstats
path: root/mbbsd/screen.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-01 18:01:51 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-01 18:01:51 +0800
commit4c256182f70ad244e0ec40af45c0c0857abb0a01 (patch)
treef2663fd39c9234b611a9d3fb8f01fcc3cecaf008 /mbbsd/screen.c
parentd2e9ddb320e18206dcb54e7d8476fdc73e489fa9 (diff)
downloadpttbbs-4c256182f70ad244e0ec40af45c0c0857abb0a01.tar
pttbbs-4c256182f70ad244e0ec40af45c0c0857abb0a01.tar.gz
pttbbs-4c256182f70ad244e0ec40af45c0c0857abb0a01.tar.bz2
pttbbs-4c256182f70ad244e0ec40af45c0c0857abb0a01.tar.lz
pttbbs-4c256182f70ad244e0ec40af45c0c0857abb0a01.tar.xz
pttbbs-4c256182f70ad244e0ec40af45c0c0857abb0a01.tar.zst
pttbbs-4c256182f70ad244e0ec40af45c0c0857abb0a01.zip
- add move_ansi() to support moving to lines with prior ANSI code.
- general improvement git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3602 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/screen.c')
-rw-r--r--mbbsd/screen.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index ee3f44f8..a9af6747 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -34,6 +34,23 @@ move(int y, int x)
}
void
+move_ansi(int y, int x)
+{
+ // take ANSI length in consideration
+ register screenline_t *slp;
+ cur_ln = y;
+ cur_col = x;
+
+ if (y >= scr_lns || x < 1)
+ return;
+
+ slp = &big_picture[y];
+ slp->data[slp->len] = 0;
+ x += (strlen((char*)slp->data) - strlen_noansi((char*)slp->data));
+ cur_col = x;
+}
+
+void
getyx(int *y, int *x)
{
*y = cur_ln;
@@ -256,9 +273,22 @@ clrtoeol(void)
register int ln;
standing = NA;
+
if (cur_col <= slp->sso)
slp->mode &= ~STANDOUT;
+ /*
+ if (cur_col == 0) // TODO and contains ANSI
+ {
+ // workaround poor ANSI issue
+ size_t sz = (slp->len > slp->oldlen) ? slp->len : slp->oldlen;
+ sz = (sz < ANSILINELEN) ? sz : ANSILINELEN;
+ memset(slp->data, ' ', sz);
+ slp->len = 0;
+ return;
+ }
+ */
+
if (cur_col > slp->oldlen) {
for (ln = slp->len; ln <= cur_col; ln++)
slp->data[ln] = ' ';