diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-12-01 18:01:51 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-12-01 18:01:51 +0800 |
commit | 4c256182f70ad244e0ec40af45c0c0857abb0a01 (patch) | |
tree | f2663fd39c9234b611a9d3fb8f01fcc3cecaf008 /mbbsd/screen.c | |
parent | d2e9ddb320e18206dcb54e7d8476fdc73e489fa9 (diff) | |
download | pttbbs-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.c | 30 |
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] = ' '; |