summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>1999-10-24 17:14:16 +0000
committerSimon Tatham <anakin@pobox.com>1999-10-24 17:14:16 +0000
commit8e0e3ac1481ea8c84aa2a0dbfb23bbb3d7700a0c (patch)
treeb93bc282935b99bb8176c91784a7d61d35925222 /misc.c
parent3cb5a6f58a56ca01547558e7b4543bf98fc25e1b (diff)
downloadhalibut-8e0e3ac1481ea8c84aa2a0dbfb23bbb3d7700a0c.zip
halibut-8e0e3ac1481ea8c84aa2a0dbfb23bbb3d7700a0c.tar.gz
halibut-8e0e3ac1481ea8c84aa2a0dbfb23bbb3d7700a0c.tar.bz2
halibut-8e0e3ac1481ea8c84aa2a0dbfb23bbb3d7700a0c.tar.xz
Macros; \- for nonbreaking hyphen
[originally from svn r252]
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/misc.c b/misc.c
index e68ed42..97caf8d 100644
--- a/misc.c
+++ b/misc.c
@@ -172,7 +172,8 @@ wrappedline *wrap_para(word *text, int width, int subsequentwidth,
while (text) {
thiswidth += widthfn(text);
if (text->next && (text->next->type == word_WhiteSpace ||
- text->next->type == word_EmphSpace)) {
+ text->next->type == word_EmphSpace ||
+ text->breaks)) {
if (thiswidth > width)
break;
spc = text->next;
@@ -192,8 +193,7 @@ wrappedline *wrap_para(word *text, int width, int subsequentwidth,
* anyway as the best we can do.
*/
if (spc && thiswidth > width) {
- w->end = spc;
- text = spc->next;
+ w->end = text = spc;
w->nspaces = nspc-1;
w->shortfall = width - lastgood;
} else if (!text) {
@@ -202,10 +202,15 @@ wrappedline *wrap_para(word *text, int width, int subsequentwidth,
w->shortfall = width - thiswidth;
} else {
w->end = text;
- text = text->next;
w->nspaces = 0;
w->shortfall = width - thiswidth;
}
+ /*
+ * Skip the space if we're on one.
+ */
+ if (text && (text->type == word_WhiteSpace ||
+ text->type == word_EmphSpace))
+ text = text->next;
width = subsequentwidth;
}