diff options
Diffstat (limited to 'mbbsd/screen.c')
-rw-r--r-- | mbbsd/screen.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/mbbsd/screen.c b/mbbsd/screen.c index 0e3e2af0..3232b1af 100644 --- a/mbbsd/screen.c +++ b/mbbsd/screen.c @@ -39,6 +39,14 @@ getyx(int *y, int *x) *x = cur_col; } +static inline +screenline_t* GetCurrentLine(){ + register int i = cur_ln + roll; + if(i >= scr_lns) + i -= scr_lns; + return &big_picture[i]; +} + static void rel_move(int was_col, int was_ln, int new_col, int new_ln) { @@ -130,6 +138,30 @@ redoscr() oflush(); } +void redoln() +{ + screenline_t *slp = GetCurrentLine(); + int len, mode; + + len = slp->len; + rel_move(tc_col, tc_line, 0, cur_ln); + if (len) + { + if ((mode = slp->mode) & STANDOUT) + standoutput((char*)slp->data, 0, len, slp->sso, slp->eso); + else + output((char*)slp->data, len); + + slp->mode = mode & ~(MODIFIED); + + slp->oldlen = tc_col = len; + } + else + clrtoeol(); + rel_move(tc_col, tc_line, cur_col, cur_ln); + oflush(); +} + void refresh() { @@ -220,13 +252,10 @@ clear() void clrtoeol() { - register screenline_t *slp; + register screenline_t *slp = GetCurrentLine(); register int ln; standing = NA; - if ((ln = cur_ln + roll) >= scr_lns) - ln -= scr_lns; - slp = &big_picture[ln]; if (cur_col <= slp->sso) slp->mode &= ~STANDOUT; @@ -272,13 +301,9 @@ clrtobot() void outc(unsigned char c) { - register screenline_t *slp; + register screenline_t *slp = GetCurrentLine(); register int i; - if ((i = cur_ln + roll) >= scr_lns) - i -= scr_lns; - slp = &big_picture[i]; - if (c == '\n' || c == '\r') { if (standing) { slp->eso = MAX(slp->eso, cur_col); @@ -440,7 +465,7 @@ standout() if (!standing && strtstandoutlen) { register screenline_t *slp; - slp = &big_picture[((cur_ln + roll) % scr_lns)]; + slp = GetCurrentLine(); standing = YEA; slp->sso = slp->eso = cur_col; slp->mode |= STANDOUT; @@ -453,7 +478,7 @@ standend() if (standing && strtstandoutlen) { register screenline_t *slp; - slp = &big_picture[((cur_ln + roll) % scr_lns)]; + slp = GetCurrentLine(); standing = NA; slp->eso = MAX(slp->eso, cur_col); } |