diff --git a/src/wrap.c b/src/wrap.c index df15327..7733334 100644 --- a/src/wrap.c +++ b/src/wrap.c @@ -238,6 +238,12 @@ void _wraptext_wrap_next (WrapTextContext *context, const WT_UTF32 c) // STATE_WORD + else if (state == WT_STATE_WORD && c == WT_HARD_LINE_BREAK) + { + _wraptext_flush_token (context); + _wraptext_new_line (context); + state = WT_STATE_START; + } else if (state == WT_STATE_WORD && _wraptext_is_newline (c)) { _wraptext_flush_token (context); diff --git a/src/wrap.h b/src/wrap.h index ec21e95..44c3993 100644 --- a/src/wrap.h +++ b/src/wrap.h @@ -13,6 +13,9 @@ // UTF8, including a terminating 0 #define WT_UTF8_MAX_BYTES 8 +// Hard line break should be an unusued code point +#define WT_HARD_LINE_BREAK 9999 + typedef uint32_t WT_UTF32; typedef char WT_UTF8; diff --git a/src/xhtml.c b/src/xhtml.c index 6bd9d76..d98ca14 100644 --- a/src/xhtml.c +++ b/src/xhtml.c @@ -632,7 +632,8 @@ void xhtml_flush_para (const WString *para, const Epub2TxtOptions *options, void xhtml_line_break (WrapTextContext *context) { IN - static uint32_t s[2] = { '\n', 0 }; + //static uint32_t s[2] = { '\n', 0 }; + static uint32_t s[2] = { WT_HARD_LINE_BREAK, 0 }; wraptext_wrap_utf32 (context, s); wraptext_eof (context); OUT