Add option to suppress blank lines between reminders in Calendar Mode.

This commit is contained in:
Dianne Skoll
2026-01-09 16:56:44 -05:00
parent d091af6e5b
commit 790a9ee384
7 changed files with 108 additions and 9 deletions

View File

@@ -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.

View File

@@ -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. */

View File

@@ -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);

View File

@@ -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;

View File

@@ -832,6 +832,7 @@ soleq
somefile
sortbanner
spc
spc2
spellintian
src
srczone

View File

@@ -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}"

View File

@@ -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 | |
+----------+----------+----------+----------+----------+----------+----------+