From d566790c0bf7178155ee91d7f8440733ef82412c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 17 Apr 2003 02:03:47 +0000 Subject: [PATCH] make the input line scrolling unsigned int clean --- libs/console/inputline.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/console/inputline.c b/libs/console/inputline.c index 1c4364384..d5d79fc42 100644 --- a/libs/console/inputline.c +++ b/libs/console/inputline.c @@ -179,12 +179,15 @@ Con_ProcessInputLine (inputline_t *il, int ch) i = il->linepos - 1; if (il->scroll > i) il->scroll = i; - if (il->scroll < i - (il->width - 2) + 1) + if (il->scroll + (il->width - 2) - 1 < i) il->scroll = i - (il->width - 2) + 1; text = il->lines[il->edit_line] + il->scroll; if (strlen (text + 1) < il->width - 2) { text = il->lines[il->edit_line]; - il->scroll = strlen (text + 1) - (il->width - 2); + if ((i = strlen (text + 1)) > (il->width - 2)) + il->scroll = i - (il->width - 2); + else + il->scroll = 0; il->scroll = max (il->scroll, 0); } if (il->draw)