diff options
Diffstat (limited to 'mbbsd/screen.c')
-rw-r--r-- | mbbsd/screen.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mbbsd/screen.c b/mbbsd/screen.c index 25ec5c22..76a4f34f 100644 --- a/mbbsd/screen.c +++ b/mbbsd/screen.c @@ -96,6 +96,32 @@ getyx(int *y, int *x) *x = cur_col; } +void +getyx_ansi(int *py, int *px) +{ + // take ANSI length in consideration + register screenline_t *slp; + int y = cur_ln, x = cur_col; + char c = 0; + + if (y < 0) y = 0; + if (y >= t_lines) y = t_lines -1; + if (x < 0) x = 0; + if (x >= ANSILINELEN) x = ANSILINELEN -1; + + *py = y; *px = x; + + if (y >= scr_lns || x < 1) + return; + + slp = &big_picture[y]; + if (slp->len < 1) + return; + c = slp->data[x]; + *px += (strlen((char*)slp->data) - strlen_noansi((char*)slp->data)); + slp->data[x] = c; +} + static inline screenline_t* GetCurrentLine(){ register int i = cur_ln + roll; |