I debugged today the columns no aligning OK on displaying a table, and found that the problem boiled down to the behaviour of lpad. Say I am using lpad
to pad the titles of columns to width 5.
Now consider
julia> s=“Ô
“Ô
julia> textwidth(s)
1
julia> textwidth(lpad(s,5))
4
So s
is not padded enough! This is according to the specification of lpad
which works in terms of
codepoints and
julia> length(s)
2
But I feel that this makes lpad
not the right function for padding. My questions are:
- Is this a known problem?
- Could this be changed in the future?
- Are there circumstances where you want
lpad
to use codepoints instead of textwidth?