summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2002-08-11 18:20:32 +0000
committerSimon Tatham <anakin@pobox.com>2002-08-11 18:20:32 +0000
commit6c0b49bfcbe1081f749a9e4c72118b014319b190 (patch)
tree35a847bdddd7ced0fd2d00105524d75149037f59
parent621a10b40a76b5f7600e041c6293cc186e878fdc (diff)
downloadhalibut-6c0b49bfcbe1081f749a9e4c72118b014319b190.zip
halibut-6c0b49bfcbe1081f749a9e4c72118b014319b190.tar.gz
halibut-6c0b49bfcbe1081f749a9e4c72118b014319b190.tar.bz2
halibut-6c0b49bfcbe1081f749a9e4c72118b014319b190.tar.xz
Fix the bug in the text back end whereby bulletted paragraphs' width
failed to be decreased to compensate for the additional indent. [originally from svn r1834]
-rw-r--r--bk_text.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bk_text.c b/bk_text.c
index 1583cbd..5df678e 100644
--- 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