8 Commits

Author SHA1 Message Date
Ingo Karkat cab86b2e5f Reimplementation: ingo#strdisplaywidth#strleft()
Avoid the downstream check and truncation by substitute()'ing any exceeding characters away. In order to exclude a character that does not entirely fit the passed width, we match for larger than the passed width plus one, and the character that comes before, similar to what we do in ingo#strdisplaywidth#HasMoreThan().
2018-10-01 14:49:28 +02:00
Ingo Karkat 44d25a552f FIX: ingo#strdisplaywidth#strleft includes multi-width character that straddles the specified width
When the character doesn't fully fit into the width, it should be excluded. Test that the result exceeds the passed width, and then remove the last character.
Add basic tests, too.
2018-10-01 14:48:52 +02:00
Ingo Karkat 9b59d26d42 Add ingo#strdisplaywidth#CutLeft() variant of ingo#strdisplaywidth#strleft() that returns both parts
Same for ingo#strdisplaywidth#strright().
2017-05-26 17:56:07 +02:00
Ingo Karkat 73955099e9 ENH: ingo#strdisplaywidth#TruncateTo() has a configurable ellipsis string g:IngoLibrary_TruncateEllipsis, now defaulting to a single-char UTF-8 variant if we're in such encoding
It also handles pathologically small lengths that only show / cut into the ellipsis.
2017-05-26 17:55:59 +02:00
Ingo Karkat 1917c0a631 Add ingo#strdisplaywidth#TruncateTo() 2017-05-26 17:49:52 +02:00
Ingo Karkat 58d5cc8aed Add ingo#strdisplaywidth#GetMinMax() 2017-05-26 17:32:35 +02:00
Ingo Karkat 151f682b1e FIX: Off-by-one in ingo#strdisplaywidth#HasMoreThan() and ingo#strdisplaywidth#strleft()
Factor out ingo#str#Reverse().
2017-05-26 17:28:29 +02:00
Ingo Karkat d74ca72b90 file creation 2017-05-26 17:25:09 +02:00