diff --git a/man/remind.1.in b/man/remind.1.in index 5d1204a1..e0874131 100644 --- a/man/remind.1.in +++ b/man/remind.1.in @@ -161,7 +161,7 @@ foreground color of a reminder and the background color of a cell, then you know what you are doing. .RE .TP -.B \-w\fR\fIcol\fR[,\fIpad\fR[,\fIspc\fR]]] +.B \-w\fR\fIcol\fR[,\fIpad\fR[,\fIspc\fR[,\fIspc2\fR]]]] The \fB\-w\fR option specifies the output width, padding and spacing of the formatted calendar output. \fICol\fR specifies the number of columns in the output device. If \fIcol\fR is not specified, or is @@ -192,7 +192,9 @@ have many reminders on certain days that make your calendar too large to fit on a page, you can try reducing \fIpad\fR to make the empty boxes smaller. \fISpc\fR specifies how many blank lines to leave between the day number and the first reminder entry. It defaults to -1. +1. \fIspc2\fR may be 0 or 1 and it specifies whether or not blank +lines should be printed in between reminders on the same day. The +default is 1, which causes the blank lines to be printed. .PP Any of \fIcol\fR, \fIpad\fR or \fIspc\fR can be omitted, providing you provide the correct number of commas. Don't use any spaces in the option. diff --git a/src/calendar.c b/src/calendar.c index 0d008784..a1f77726 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -1525,11 +1525,14 @@ static int WriteOneColLine(int col) int clamp = 1; int numwritten = 0; int d = ColToDay[col]; - char const *url = get_url(e->infos); + char const *url; if (d && UseBGVTColors && bgcolor[d][0] != -1) { clamp = 0; } + PRINTROW: + url = get_url(e->infos); + /* Print as many characters as possible within the column */ if (e->wc_text) { wspace = NULL; @@ -1538,14 +1541,21 @@ static int WriteOneColLine(int col) /* If we're at the end, and there's another entry, do a blank line and move to next entry. */ if (!*ws && e->next) { - PrintLeft("", ColSpaces, ' '); + if (CalSepLine) { + PrintLeft("", ColSpaces, ' '); + } CalColumn[col] = e->next; free(e->text); free(e->raw_text); if (e->wc_text) free(e->wc_text); FreeTrigInfoChain(e->infos); free(e); - return 1; + if (!CalSepLine) { + e = CalColumn[col]; + goto PRINTROW; + } else { + return 1; + } } /* Find the last space char within the column. */ @@ -1648,14 +1658,22 @@ static int WriteOneColLine(int col) /* If we're at the end, and there's another entry, do a blank line and move to next entry. */ if (!*s && e->next) { - PrintLeft("", ColSpaces, ' '); + if (CalSepLine) { + PrintLeft("", ColSpaces, ' '); + } CalColumn[col] = e->next; free(e->text); if (e->wc_text) free(e->wc_text); free(e->raw_text); FreeTrigInfoChain(e->infos); free(e); - return 1; + if (!CalSepLine) { + e = CalColumn[col]; + fprintf(stderr, "BLOOP\n"); + goto PRINTROW; + } else { + return 1; + } } /* Find the last space char within the column. */ diff --git a/src/globals.h b/src/globals.h index 438fdec6..7dd0bc25 100644 --- a/src/globals.h +++ b/src/globals.h @@ -146,6 +146,7 @@ EXTERN int ArgC; EXTERN char const **ArgV; EXTERN INIT( int CalLines, CAL_LINES); EXTERN INIT( int CalPad, 1); +EXTERN INIT( int CalSepLine, 1); EXTERN INIT( int UseVTChars, 0); EXTERN INIT( int UseBGVTColors, 0); EXTERN INIT( int UseUTF8Chars, 0); diff --git a/src/init.c b/src/init.c index aeb1e3c7..8b1ae08d 100644 --- a/src/init.c +++ b/src/init.c @@ -644,8 +644,17 @@ void InitRemind(int argc, char const *argv[]) } if (*arg == ',') { arg++; - PARSENUM(CalPad, arg); - if (CalPad > 20) CalPad = 20; + if (*arg != ',') { + PARSENUM(CalPad, arg); + if (CalPad > 20) CalPad = 20; + } + if (*arg == ',') { + arg++; + PARSENUM(CalSepLine, arg); + if (CalSepLine) { + CalSepLine = 1; + } + } } } break; diff --git a/tests/manpage-personal-dict b/tests/manpage-personal-dict index 3dd88bd0..4ba9b331 100644 --- a/tests/manpage-personal-dict +++ b/tests/manpage-personal-dict @@ -832,6 +832,7 @@ soleq somefile sortbanner spc +spc2 spellintian src srczone diff --git a/tests/test-rem b/tests/test-rem index fca15b0c..60561432 100644 --- a/tests/test-rem +++ b/tests/test-rem @@ -969,6 +969,25 @@ REM 16 INFO "Url: https://dianne.skoll.ca" MSF Hello, linky! REM 17 INFO "Url: https://dianne.skoll.ca" CAL Hello, linky! REM 18 INFO "Url: https://dianne.skoll.ca" SPECIAL COLOR 255 0 0 Hello, linky! EOF + +# Turn off spacing between reminders.. +$REMIND -w,0,0,0 -@2 -c - 1 Jan 2020 <<'EOF' >> $OUT 2>&1 +SET $TerminalHyperlinks 1 +REM 15 INFO "Url: https://dianne.skoll.ca" MSG Hello, linky 1! +REM 15 INFO "Url: https://dianne.skoll.ca" MSF Hello, linky 2! +REM 15 INFO "Url: https://dianne.skoll.ca" CAL Hello, linky 3! +REM 15 INFO "Url: https://dianne.skoll.ca" SPECIAL COLOR 255 0 0 Hello, linky 4! +EOF + +# Turn on spacing between reminders.. +$REMIND -w,0,0,1 -@2 -c - 1 Jan 2020 <<'EOF' >> $OUT 2>&1 +SET $TerminalHyperlinks 1 +REM 15 INFO "Url: https://dianne.skoll.ca" MSG Hello, linky 1! +REM 15 INFO "Url: https://dianne.skoll.ca" MSF Hello, linky 2! +REM 15 INFO "Url: https://dianne.skoll.ca" CAL Hello, linky 3! +REM 15 INFO "Url: https://dianne.skoll.ca" SPECIAL COLOR 255 0 0 Hello, linky 4! +EOF + cmp -s $OUT $CMP if [ "$?" = "0" ]; then echo "Remind: Acceptance tests ${GRN}PASSED${NRM}" diff --git a/tests/test.cmp b/tests/test.cmp index 798d53a0..5103b01c 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -40175,4 +40175,53 @@ February 28 +----------+----------+----------+----------+----------+----------+----------+ |26 ‎ |27 ‎ |28 ‎ |29 ‎ |30 ‎ |31 ‎ | | +----------+----------+----------+----------+----------+----------+----------+ + +----------------------------------------------------------------------------+ +| January 2020‎ | ++----------+----------+----------+----------+----------+----------+----------+ +| Sunday‎ | Monday‎ | Tuesday‎ |Wednesday‎ | Thursday‎ | Friday‎ | Saturday‎ | ++----------+----------+----------+----------+----------+----------+----------+ +| | | |1 ‎ |2 ‎ |3 ‎ |4 ‎ | ++----------+----------+----------+----------+----------+----------+----------+ +|5 ‎ |6 ‎ |7 ‎ |8 ‎ |9 ‎ |10 ‎ |11 ‎ | ++----------+----------+----------+----------+----------+----------+----------+ +|12 ‎ |13 ‎ |14 ‎ |15 ‎ |16 ‎ |17 ‎ |18 ‎ | +| | | |]8;;https://dianne.skoll.ca\Hello,]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\linky 1!]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\Hello,]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\linky 2!]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\Hello,]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\linky 3!]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\Hello,]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\linky 4!]8;;\‎ | | | | ++----------+----------+----------+----------+----------+----------+----------+ +|19 ‎ |20 ‎ |21 ‎ |22 ‎ |23 ‎ |24 ‎ |25 ‎ | ++----------+----------+----------+----------+----------+----------+----------+ +|26 ‎ |27 ‎ |28 ‎ |29 ‎ |30 ‎ |31 ‎ | | ++----------+----------+----------+----------+----------+----------+----------+ + +----------------------------------------------------------------------------+ +| January 2020‎ | ++----------+----------+----------+----------+----------+----------+----------+ +| Sunday‎ | Monday‎ | Tuesday‎ |Wednesday‎ | Thursday‎ | Friday‎ | Saturday‎ | ++----------+----------+----------+----------+----------+----------+----------+ +| | | |1 ‎ |2 ‎ |3 ‎ |4 ‎ | ++----------+----------+----------+----------+----------+----------+----------+ +|5 ‎ |6 ‎ |7 ‎ |8 ‎ |9 ‎ |10 ‎ |11 ‎ | ++----------+----------+----------+----------+----------+----------+----------+ +|12 ‎ |13 ‎ |14 ‎ |15 ‎ |16 ‎ |17 ‎ |18 ‎ | +| | | |]8;;https://dianne.skoll.ca\Hello,]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\linky 1!]8;;\‎ | | | | +| | | | | | | | +| | | |]8;;https://dianne.skoll.ca\Hello,]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\linky 2!]8;;\‎ | | | | +| | | | | | | | +| | | |]8;;https://dianne.skoll.ca\Hello,]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\linky 3!]8;;\‎ | | | | +| | | | | | | | +| | | |]8;;https://dianne.skoll.ca\Hello,]8;;\‎ | | | | +| | | |]8;;https://dianne.skoll.ca\linky 4!]8;;\‎ | | | | ++----------+----------+----------+----------+----------+----------+----------+ +|19 ‎ |20 ‎ |21 ‎ |22 ‎ |23 ‎ |24 ‎ |25 ‎ | ++----------+----------+----------+----------+----------+----------+----------+ +|26 ‎ |27 ‎ |28 ‎ |29 ‎ |30 ‎ |31 ‎ | | ++----------+----------+----------+----------+----------+----------+----------+ \ No newline at end of file