diff options
| author | Simon Tatham <anakin@pobox.com> | 1999-10-22 13:24:30 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 1999-10-22 13:24:30 +0000 |
| commit | 8022a13d69f8f24c54df96b140bd9eb84b23a5f1 (patch) | |
| tree | 5fe79100c90e3ce0c846f10653cccb40fa1f322a /misc.c | |
| parent | 3ea5db22e2af7b4446528de78b4c51bc3cd0559b (diff) | |
| download | halibut-8022a13d69f8f24c54df96b140bd9eb84b23a5f1.zip halibut-8022a13d69f8f24c54df96b140bd9eb84b23a5f1.tar.gz halibut-8022a13d69f8f24c54df96b140bd9eb84b23a5f1.tar.bz2 halibut-8022a13d69f8f24c54df96b140bd9eb84b23a5f1.tar.xz | |
Introduce word types for attributed spaces, so backends can distinguish
between emphasis _like_ _this_ and _like this_
[originally from svn r245]
Diffstat (limited to 'misc.c')
| -rw-r--r-- | misc.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -132,6 +132,26 @@ int compare_wordlists(word *a, word *b) { return 0; } +void mark_attr_ends(paragraph *sourceform) { + paragraph *p; + word *w, *wp; + for (p = sourceform; p; p = p->next) { + wp = NULL; + for (w = p->words; w; w = w->next) { + if (isattr(w->type)) { + int before = (wp && isattr(wp->type) && + sameattr(wp->type, w->type)); + int after = (w->next && isattr(w->next->type) && + sameattr(w->next->type, w->type)); + w->aux = (before ? + (after ? attr_Always : attr_Last) : + (after ? attr_First : attr_Only)); + } + wp = w; + } + } +} + wrappedline *wrap_para(word *text, int width, int subsequentwidth, int (*widthfn)(word *)) { wrappedline *head = NULL, **ptr = &head; @@ -151,7 +171,8 @@ wrappedline *wrap_para(word *text, int width, int subsequentwidth, thiswidth = lastgood = 0; while (text) { thiswidth += widthfn(text); - if (text->next && text->next->type == word_WhiteSpace) { + if (text->next && (text->next->type == word_WhiteSpace || + text->next->type == word_EmphSpace)) { if (thiswidth > width) break; spc = text->next; |