Treat non printable characters as zero-width instead of -1 width
This fix a bug when opening a file where a line has a lot of unprintable chars (like a binary file) which was confusing Kakoune into considering that the line length in column was negative.
This commit is contained in:
parent
620e718087
commit
6604aa66f7
|
@ -55,7 +55,10 @@ inline bool is_basic_alpha(Codepoint c) noexcept
|
|||
|
||||
inline ColumnCount codepoint_width(Codepoint c) noexcept
|
||||
{
|
||||
return c == '\n' ? 1 : wcwidth((wchar_t)c);
|
||||
if (c == '\n')
|
||||
return 1;
|
||||
const auto width = wcwidth((wchar_t)c);
|
||||
return width > 0 ? width : 0;
|
||||
}
|
||||
|
||||
enum class CharCategories
|
||||
|
|
Loading…
Reference in New Issue
Block a user