git-svn-id: https://svn.eduke32.com/eduke32@847 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-07-09 09:34:12 +00:00
parent eece4e2b75
commit 098c99e3f7

View file

@ -656,8 +656,8 @@ static int OSD_FindDiffPoint(const char *str1, const char *str2)
static void OSD_HistoryPrev(void) static void OSD_HistoryPrev(void)
{ {
if (osdhistorypos < osdhistorysize-1) if (osdhistorypos >= osdhistorysize-1) return;
{
osdhistorypos++; osdhistorypos++;
memcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1); memcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1);
osdeditlen = osdeditcursor = 0; osdeditlen = osdeditcursor = 0;
@ -675,12 +675,11 @@ static void OSD_HistoryPrev(void)
osdeditwinstart+=(osdeditcursor-osdeditwinend), osdeditwinstart+=(osdeditcursor-osdeditwinend),
osdeditwinend+=(osdeditcursor-osdeditwinend); osdeditwinend+=(osdeditcursor-osdeditwinend);
} }
}
static void OSD_HistoryNext(void) static void OSD_HistoryNext(void)
{ {
if (osdhistorypos >= 0) if (osdhistorypos < 0) return;
{
if (osdhistorypos == 0) if (osdhistorypos == 0)
{ {
osdeditlen=0; osdeditlen=0;
@ -688,9 +687,9 @@ static void OSD_HistoryNext(void)
osdeditwinstart=0; osdeditwinstart=0;
osdeditwinend=editlinewidth; osdeditwinend=editlinewidth;
osdhistorypos = -1; osdhistorypos = -1;
return;
} }
else
{
osdhistorypos--; osdhistorypos--;
memcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1); memcpy(osdeditbuf, osdhistorybuf[osdhistorypos], EDITLENGTH+1);
osdeditlen = osdeditcursor = 0; osdeditlen = osdeditcursor = 0;
@ -708,8 +707,6 @@ static void OSD_HistoryNext(void)
osdeditwinstart+=(osdeditcursor-osdeditwinend), osdeditwinstart+=(osdeditcursor-osdeditwinend),
osdeditwinend+=(osdeditcursor-osdeditwinend); osdeditwinend+=(osdeditcursor-osdeditwinend);
} }
}
}
int OSD_HandleChar(char ch) int OSD_HandleChar(char ch)
{ {
@ -781,11 +778,7 @@ int OSD_HandleChar(char ch)
{ {
tabc = findsymbol(osdedittmp, NULL); tabc = findsymbol(osdedittmp, NULL);
if (tabc) if (tabc && tabc->next && findsymbol(osdedittmp, tabc->next))
{
if (tabc->next)
{
if (findsymbol(osdedittmp, tabc->next))
{ {
symbol_t *symb=tabc; symbol_t *symb=tabc;
int maxwidth = 0, x = 0, num = 0; int maxwidth = 0, x = 0, num = 0;
@ -814,25 +807,21 @@ int OSD_HandleChar(char ch)
maxwidth += 3; maxwidth += 3;
symb = tabc; symb = tabc;
OSD_Printf(" "); OSD_Printf(" ");
while (symb && symb != lastmatch) while (symb && (symb != lastmatch))
{ {
tabc = symb; tabc = lastmatch = symb;
OSD_Printf("%-*s",maxwidth,symb->name); OSD_Printf("%-*s",maxwidth,symb->name);
x += maxwidth;
lastmatch = symb;
symb=findsymbol(osdedittmp, lastmatch->next); symb=findsymbol(osdedittmp, lastmatch->next);
if (x > osdcols - maxwidth) x += maxwidth;
if (x > (osdcols - maxwidth))
{ {
x = 0; x = 0;
OSD_Printf("\n"); OSD_Printf("\n");
if (symb && symb != lastmatch) if (symb && (symb != lastmatch))
OSD_Printf(" "); OSD_Printf(" ");
} }
} }
if (x) if (x) OSD_Printf("\n");
OSD_Printf("\n");
}
}
} }
} }
} }