Fix the bug in the text back end whereby bulletted paragraphs' width
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 11 Aug 2002 18:20:32 +0000 (18:20 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 11 Aug 2002 18:20:32 +0000 (18:20 +0000)
failed to be decreased to compensate for the additional indent.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@1834 cda61777-01e9-0310-a592-d414129be87e

bk_text.c

index 1583cbd..5df678e 100644 (file)
--- a/bk_text.c
+++ b/bk_text.c
@@ -91,7 +91,7 @@ static textconfig text_configure(paragraph *source) {
            } else if (!ustricmp(source->keyword, L"text-chapter-underline")) {
                ret.achapter.underline = *uadv(source->keyword);
            } else if (!ustricmp(source->keyword, L"text-chapter-numeric")) {
-               ret.achapter.underline = utob(uadv(source->keyword));
+               ret.achapter.just_numbers = utob(uadv(source->keyword));
            } else if (!ustricmp(source->keyword, L"text-section-align")) {
                wchar_t *p = uadv(source->keyword);
                int n = 0;
@@ -269,7 +269,8 @@ void text_backend(paragraph *sourceform, keywordlist *keywords,
            body = p->words;
        }
        text_para(fp, prefix, prefixextra, body,
-                 conf.indent + indentb, indenta, conf.width);
+                 conf.indent + indentb, indenta,
+                 conf.width - indentb - indenta);
        if (wp) {
            wp->next = NULL;
            free_word_list(body);
@@ -535,15 +536,16 @@ static void text_para(FILE *fp, word *prefix, char *prefixextra, word *text,
        if (prefixextra)
            rdaddsc(&pfx, prefixextra);
        fprintf(fp, "%*s%s", indent, "", pfx.text);
+       /* If the prefix is too long, shorten the first line to fit. */
        e = extraindent - strlen(pfx.text);
        if (e < 0) {
-           e = 0;
-           firstlinewidth -= e;
+           firstlinewidth += e;       /* this decreases it, since e < 0 */
            if (firstlinewidth < 0) {
                e = indent + extraindent;
                firstlinewidth = width;
                fprintf(fp, "\n");
-           }
+           } else
+               e = 0;
        }
        sfree(pfx.text);
     } else