Skip to content

Commit

Permalink
Show fewer than 6 tab matches on a single column
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler committed Mar 3, 2024
1 parent e1a9f0e commit a352e9c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Quake/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -1730,14 +1730,15 @@ static void Con_PrintTabList (void)
tab_t *t;

// determine maximum item length
maxlen = 0;
matches = maxlen = 0;
t = tablist;
do
{
Con_FormatTabMatch (t, buf, sizeof (buf));
total = (int) strlen (buf);
maxlen = q_max (maxlen, total);
t = t->next;
++matches;
} while (t != tablist);

// determine number of columns
Expand All @@ -1749,10 +1750,12 @@ static void Con_PrintTabList (void)
cols = q_max (con_linewidth, maxlen) / maxlen;
if (con_maxcols.value >= 1.f)
cols = q_min (cols, (int) con_maxcols.value); // apply user limit
if (matches < 6) // single column if fewer than 6 matches
cols = 1;

// print all matches
Con_SafePrintf("\n");
i = matches = total = 0;
i = total = 0;
t = tablist;
do
{
Expand All @@ -1767,7 +1770,6 @@ static void Con_PrintTabList (void)
if (t->type && t->type[0] == '#' && !t->type[1])
total += t->count;
t = t->next;
++matches;
} while (t != tablist);
if (i != 0)
Con_SafePrintf ("\n");
Expand Down

0 comments on commit a352e9c

Please sign in to comment.