the input line is almost perfect: just some problems with the scroll

indicators
This commit is contained in:
Bill Currie 2001-07-11 00:19:39 +00:00
parent 5642ac87cb
commit 038e2c9287
1 changed files with 36 additions and 5 deletions

View File

@ -119,7 +119,11 @@ Con_Init (void)
init_pair (4, COLOR_YELLOW, COLOR_BLUE);
scrollok (output, TRUE);
leaveok (output, TRUE);
scrollok (status, FALSE);
leaveok (status, TRUE);
scrollok (input, FALSE);
nodelay (input, TRUE);
keypad (input, TRUE);
@ -158,8 +162,11 @@ Con_ProcessInput (void)
{
int ch = wgetch (input);
int i;
int curs_x;
char *text = 0;
static int scroll;
switch (ch) {
case KEY_ENTER:
case '\n':
@ -252,13 +259,37 @@ Con_ProcessInput (void)
}
break;
}
curs_x = key_linepos - scroll;
if (curs_x < 1) {
scroll += curs_x - 1;
curs_x = 1;
} else if (curs_x > screen_x - 2) {
scroll += curs_x - (screen_x - 2);
curs_x = screen_x - 2;
}
text = key_lines[edit_line] + scroll;
if (scroll && strlen (text) < screen_x - 2) {
scroll = strlen (key_lines[edit_line]) - (screen_x - 2);
text = key_lines[edit_line] + scroll;
curs_x = key_linepos - scroll;
}
werase (input);
text = key_lines[edit_line];
if (screen_x < strlen (text) - 1)
text += screen_x - (strlen (text) - 1);
wmove (input, 0, 0);
while (*text)
i = 0;
#if 0
if (scroll) {
waddch (input, '<');
text++;
i++;
}
#endif
for (; i < screen_x - 2 && *text; i++)
waddch (input, *text++);
if (*text) {
waddch (input, '>');
}
wmove (input, 0, curs_x);
touchline (stdscr, screen_y - 1, 1);
wrefresh (input);
}