On 31 Jul 2012, at 6:46 PM, Meikel Brandmeyer wrote:
> There probably lurk more multibyte issues. Let me know when you find
> something. Korean is probably a good candidate.
There is another corner case:
(let [숫자 ["하나"
"둘" # Indent off by 2
"셋"]
ᄉ (reduce
#(+ %1 (count (.getBytes %2))) ; Off by 1
0 숫자)]
...)
The problem here is that searchpairpos() returns the column number as a
byte offset, instead of the virtual column count.
Unfortunately, vim does not offer an option to make searchpairpos() (or
any of the other functions that return columns) return virtcols, so it
must be explicitly converted. The overhead of virtcol() is negligible
(~ 0.04 ms), so at least performance is not an issue.
I am sorry this is coming after the 2.3.4 release. I held off on sending
this in while I searched vim for a magic make-everything-return-virtcols
toggle. It does not seem to exist.
Cheers,
Sung Pae
---
vim/indent/clojure.vim | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/vim/indent/clojure.vim b/vim/indent/clojure.vim
index cdf3e18..5fae206 100644
--- a/vim/indent/clojure.vim
+++ b/vim/indent/clojure.vim
@@ -32,9 +32,10 @@ function! s:MatchPairs(open, close, stopat)
let stopat = a:stopat
endif
- return searchpairpos(a:open, '', a:close, 'bWn',
+ let pos = searchpairpos(a:open, '', a:close, 'bWn',
\ 'vimclojure#util#SynIdName() !~ "clojureParen\\d"',
\ stopat)
+ return [pos[0], virtcol(pos)]
endfunction
function! ClojureCheckForStringWorker() dict
--
1.7.10.2.520.g6a4a482