summaryrefslogtreecommitdiff
path: root/src/string.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-08-26 00:08:34 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-08-26 00:08:34 +0100
commit7ac54b0b0fc300e9f9c21430e4cd5f87c31f9ac9 (patch)
tree195d5e9164d5235ca0a68ba1ca401b0e8d5c623e /src/string.cc
parent3f0415c765699cbeefac68090f146ee80d03827d (diff)
Fix another bug in wrap_lines
Diffstat (limited to 'src/string.cc')
-rw-r--r--src/string.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/string.cc b/src/string.cc
index 638eabdb..edfd4cf6 100644
--- a/src/string.cc
+++ b/src/string.cc
@@ -415,6 +415,7 @@ Vector<StringView> wrap_lines(StringView text, CharCount max_width)
{
auto line_end = last_word_end <= line_begin ? line_begin + max_width
: last_word_end;
+
lines.emplace_back(line_begin.base(), line_end.base());
while (line_end != end and is_horizontal_blank(*line_end))
@@ -428,7 +429,8 @@ Vector<StringView> wrap_lines(StringView text, CharCount max_width)
if (cat == CharCategories::Word or cat == CharCategories::Punctuation)
last_word_end = word_end;
- it = word_end;
+ if (word_end > line_begin)
+ it = word_end;
}
if (line_begin != end)
lines.emplace_back(line_begin.base(), text.end());