From 61d51a1fab7d1f2a6dd23f472237425dea5a450d Mon Sep 17 00:00:00 2001 From: piaip Date: Thu, 12 Apr 2012 14:17:30 +0000 Subject: Fix screen line calculation. #1FXflAsI (PttCurrent) git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5628 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/screen.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pttbbs/mbbsd/screen.c b/pttbbs/mbbsd/screen.c index b03dd784..606ec5e2 100644 --- a/pttbbs/mbbsd/screen.c +++ b/pttbbs/mbbsd/screen.c @@ -18,6 +18,16 @@ static unsigned char _typeahead = 1; #define MODIFIED (1) /* if line has been modifed, screen output */ #define STANDOUT (2) /* if this line has a standout region */ +inline +screenline_t* GetLine(int i) { + return &big_picture[(i + roll) % scr_lns]; +} + +inline +screenline_t* GetCurrentLine() { + return GetLine(cur_ln); +} + void change_scroll_range(int top, int bottom) { @@ -122,7 +132,7 @@ move_ansi(int y, int x) if (y >= scr_lns || x < 1) return; - slp = &big_picture[y]; + slp = GetLine(y); if (slp->len < 1) return; @@ -156,7 +166,7 @@ getyx_ansi(int *py, int *px) if (y >= scr_lns || x < 1) return; - slp = &big_picture[y]; + slp = GetLine(y); if (slp->len < 1) return; c = slp->data[x]; @@ -165,14 +175,6 @@ getyx_ansi(int *py, int *px) slp->data[x] = c; } -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) { -- cgit v1.2.3