On 2009-04-16, Tony Mechelynck <[email protected]> wrote:
>>
>> Y. Hida wrote:
>>> Is there a way figure out how wide a string containing double-width
>>> characters are when displayed? I'm trying to right-justify some strings
>>> in foldtext.
<snip>
>
>
> Here's another proposal, which can meet every possibility, and doesn't
> loop over all characters (faster for long strings), but at the cost of
> opening a temporary window (IOW, it requires has('windows))
>
> function VirtLen(string)
> new
> 0put =a:string
> let rv = virtcol('$') - 1
> q!
> return rv
> endfunction
>
After some digging I found out that this doesn't work for foldtext since
it is evaluated in a sandbox. Argh. I guess I'll either use the other
poster's method, or use perl (apparently you can use perl from sandbox ?)
-Yozo
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---