mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Pattern: Reduce row clue spacing if there are lots of them
Normally, we put two spaces between row clues, but if there are a lot then even with a smaller font size they might overflow the left edge of the window. To compensate, go down to one space between clues instead of two if there are a lot of them. On my laptop the GTK build demonstrates overflow with "13x1:1//1//1//1//1//1//1/1.1.1.1.1.1.1".
This commit is contained in:
@ -1853,11 +1853,15 @@ static void draw_numbers(
|
||||
} else {
|
||||
int x, y;
|
||||
size_t off = 0;
|
||||
const char *spaces = " ";
|
||||
|
||||
assert(rowlen <= state->common->rowsize);
|
||||
*ds->strbuf = '\0';
|
||||
/* Squish up a bit if there are lots of clues. */
|
||||
if (rowlen > TLBORDER(state->common->w)) spaces++;
|
||||
for (j = 0; j < rowlen; j++)
|
||||
off += sprintf(ds->strbuf + off, "%s%d", j ? " " : "", rowdata[j]);
|
||||
off += sprintf(ds->strbuf + off, "%s%d",
|
||||
j ? spaces : "", rowdata[j]);
|
||||
y = ry;
|
||||
x = BORDER + TILE_SIZE * (TLBORDER(state->common->w)-1);
|
||||
draw_text(dr, x+TILE_SIZE, y+TILE_SIZE/2, FONT_VARIABLE,
|
||||
|
Reference in New Issue
Block a user