diff options
| author | Maxime Coste <mawww@kakoune.org> | 2016-12-14 13:53:30 +0000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2016-12-14 13:53:30 +0000 |
| commit | 377046e31567554261b5e392a0d4fedc19ce8258 (patch) | |
| tree | e4a81942cac5de9ce1dafed24e640469151e3651 /src/string.hh | |
| parent | 85cd27138ded36c6f60bc0f50dbde2028f213b5c (diff) | |
Handle correctly cases where codepoint_width returns -1
Fixes #972
Diffstat (limited to 'src/string.hh')
| -rw-r--r-- | src/string.hh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string.hh b/src/string.hh index d7e39ff9..6fd2f5fb 100644 --- a/src/string.hh +++ b/src/string.hh @@ -114,7 +114,7 @@ public: explicit String(Codepoint cp, ColumnCount count) { kak_assert(count % codepoint_width(cp) == 0); - int cp_count = (int)(count / codepoint_width(cp)); + int cp_count = (int)(count / std::max(codepoint_width(cp), 1_col)); reserve(utf8::codepoint_size(cp) * cp_count); while (cp_count-- > 0) utf8::dump(std::back_inserter(*this), cp); |
