mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
console.c: some long input line fixes (keep cursor on screen, don't clip line early, buffer size fix)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@598 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
fb02af5a08
commit
dc9166c3b8
1 changed files with 7 additions and 4 deletions
|
@ -1140,7 +1140,7 @@ void Con_DrawInput (void)
|
|||
extern double key_blinktime;
|
||||
extern int key_insert;
|
||||
int i, len;
|
||||
char c[MAXCMDLINE], *text;
|
||||
char c[MAXCMDLINE+1] /* extra space == +1 */, *text;
|
||||
|
||||
if (key_dest != key_console && !con_forcedup)
|
||||
return; // don't draw anything
|
||||
|
@ -1154,15 +1154,18 @@ void Con_DrawInput (void)
|
|||
|
||||
// prestep if horizontally scrolling
|
||||
if (key_linepos >= con_linewidth)
|
||||
text += 1 + key_linepos - con_linewidth;
|
||||
text += key_linepos - con_linewidth;
|
||||
|
||||
// draw input string
|
||||
for (i = 0; i <= (int)strlen(text) - 1; i++) //only write enough letters to go from *text to cursor
|
||||
for (i = 0; i < q_min((int)strlen(text), con_linewidth + 1); i++) //only write enough letters to go from *text to cursor
|
||||
Draw_Character ((i+1)<<3, vid.conheight - 16, text[i]);
|
||||
|
||||
// johnfitz -- new cursor handling
|
||||
if (!((int)((realtime-key_blinktime)*con_cursorspeed) & 1))
|
||||
Draw_Pic ((key_linepos+1)<<3, vid.conheight - 16, key_insert ? pic_ins : pic_ovr);
|
||||
{
|
||||
i = key_linepos < con_linewidth ? key_linepos : con_linewidth;
|
||||
Draw_Pic ((i+1)<<3, vid.conheight - 16, key_insert ? pic_ins : pic_ovr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue