From 1645e3c681d11d813a20294918af026b8810f023 Mon Sep 17 00:00:00 2001 From: kst Date: Thu, 13 Aug 2020 13:44:09 +0000 Subject: [PATCH] Suppress sentence spacing after end-of-sentence characters. This should fix the inconsistent spacing issue mentioned in [1]. I also fixed a spacing in issue in the man page. [1]: https://lists.sr.ht/~sircmpwn/public-inbox/%3CC4VKFSIFINOA.X6VCIU2AV88M%40szk%3E --- scdoc.5.scd | 2 +- src/main.c | 9 ++++++++- test/line-breaks | 9 +++++++++ diff --git a/scdoc.5.scd b/scdoc.5.scd index f4d393be89a86bcc6e003dbe092240f7af95cab5..b548b81a4e1f702843d66ae6b3ee5b4cb8dab48b 100644 --- a/scdoc.5.scd +++ b/scdoc.5.scd @@ -120,7 +120,7 @@ Each line of a table should start with | or : to start a new row or column respectively (or space to continue the previous cell on multiple lines), followed by [ or - or ] to align the contents to the left, center, or right, -followed by a space and the contents of that cell. You may use a space instead +followed by a space and the contents of that cell. You may use a space instead of an alignment specifier to inherit the alignment of the same column in the previous row. diff --git a/src/main.c b/src/main.c index 7bb6c4204e4297558f84b99111a7e51a390d8a28..8c5ffeb23fb9850c072e7568fa995fc0bc68de4f 100644 --- a/src/main.c +++ b/src/main.c @@ -241,10 +241,17 @@ return; case '.': if (!i) { // Escape . if it's the first character - fprintf(p->output, "\\&."); + fprintf(p->output, "\\&.\\&"); break; } /* fallthrough */ + case '!': + case '?': + last = ch; + utf8_fputch(p->output, ch); + // Suppress sentence spacing + fprintf(p->output, "\\&"); + break; default: last = ch; utf8_fputch(p->output, ch); diff --git a/test/line-breaks b/test/line-breaks index c119bd9a175bfb00b62be8bfd8a9ae488773dc62..83dc70364076baed1b96a58a5e9a4c751acc47b9 100755 --- a/test/line-breaks +++ b/test/line-breaks @@ -44,3 +44,12 @@ hello++ _world_ EOF end 0 + +begin "Suppresses sentence spacing" +scdoc </dev/null +test(8) + +hel!lo. +world. +EOF +end 0 -- 2.48.1