Fortune: handle multibyte characters

This commit is contained in:
Marco Hinz 2017-01-11 12:57:33 +01:00
parent 89bf0a5c24
commit f3044c7f52
No known key found for this signature in database
GPG key ID: 1C980A1B657B4A4F
2 changed files with 3 additions and 3 deletions

View file

@ -838,7 +838,7 @@ How do I center my header/footer?~
Try something along these lines:
>
function! s:filter_header(lines) abort
let longest_line = max(map(copy(a:lines), 'len(v:val)'))
let longest_line = max(map(copy(a:lines), 'strwidth(v:val)'))
let centered_lines = map(copy(a:lines),
\ 'repeat(" ", (&columns / 2) - (longest_line / 2)) . v:val')
return centered_lines