From bbbbc8b22bae0aa15b48273f763b0e215df0c7af Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 24 Apr 2023 22:25:12 +0100 Subject: [PATCH] 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". --- pattern.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pattern.c b/pattern.c index 9142c48..9748c6f 100644 --- a/pattern.c +++ b/pattern.c @@ -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,