magnars/s.el

Some unexpected results of s-truncate

Closed this issue · 2 comments

(s-truncate 2 "Albuquerque") => "Albuquerqu..."
(s-truncate 2 "Ohio") => "Ohi..."
(s-truncate 0 "Ohio") => "O..."
(s-truncate 1 "Ox") => "..."
(s-truncate 0 "Ox") => args-out-of-range

All these results seem unexpected to me.

Yeah, those are weird. Given the functionality of s-truncate, what would you expect?

Signal args-out-of-range if LEN is negative; otherwise I'd suggest returning 0-2 dots.