dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 4b8ba181019a315dd71dfb852ad77a5525acb6bb
parent 6ffa79c78ca336dc4bceda04ace59e56966bfe9e
Author: Ross Mohn <rpmohn@waxandwane.org>
Date:   Tue, 10 Jul 2012 14:43:33 +0200

vt: respect relative position mode when clamping cursor

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
vt.c | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/vt.c b/vt.c @@ -248,10 +248,13 @@ static void row_roll(Row *start, Row *end, int count) static void clamp_cursor_to_bounds(Vt *t) { - if (t->curs_row < t->lines) - t->curs_row = t->lines; - if (t->curs_row >= t->lines + t->rows) - t->curs_row = t->lines + t->rows - 1; + Row *lines = t->relposmode ? t->scroll_top : t->lines; + int rows = t->relposmode ? t->scroll_bot - t->scroll_top : t->rows; + + if (t->curs_row < lines) + t->curs_row = lines; + if (t->curs_row >= lines + rows) + t->curs_row = lines + rows - 1; if (t->curs_col < 0) t->curs_col = 0; if (t->curs_col >= t->cols)