[SCM] Vim packaging branch, deb/runtime, updated. upstream/7.1.285-62-g9a8a6f7

James Vega jamessan at debian.org
Sun Jun 1 15:06:49 UTC 2008


The following commit has been merged in the deb/runtime branch:
commit 9a8a6f7fccb296be42c2c77550bb2acd554a249b
Author: James Vega <jamessan at debian.org>
Date:   Sun Jun 1 11:05:08 2008 -0400

    Calculate strlen for multi-byte strings properly.
    
    Closes: #481115
    
    Signed-off-by: James Vega <jamessan at debian.org>

diff --git a/runtime/macros/justify.vim b/runtime/macros/justify.vim
index 41d0591..aa4a9ca 100644
--- a/runtime/macros/justify.vim
+++ b/runtime/macros/justify.vim
@@ -256,17 +256,18 @@ function! Justify(...) range
 	let str = substitute(str, '\s\+$', '', '')
 	let str = substitute(str, '^\s\+', '', '')
 	let str = substitute(str, '\s\+', ' ', 'g')
-	let str_n = strlen(str)
+	" Use substitute() hack to get strlen in characters instead of bytes
+	let str_n = strlen(substitute(str, '.', 'x', 'g'))
 
 	" Possible addition of space after punctuation
 	if exists("join_str")
 	    let str = substitute(str, join_str, '\1 ', 'g')
 	endif
-	let join_n = strlen(str) - str_n
+	let join_n = strlen(substitute(str, '.', 'x', 'g')) - str_n
 
 	" Can extraspaces be added?
 	" Note that str_n may be less than strlen(str) [joinspaces above]
-	if strlen(str) < tw - indent_n && str_n > 0
+	if strlen(substitute(str, '.', 'x', 'g')) < tw - indent_n && str_n > 0
 	    " How many spaces should be added
 	    let s_add = tw - str_n - indent_n - join_n
 	    let s_nr  = strlen(substitute(str, '\S', '', 'g') ) - join_n

-- 
Vim packaging



More information about the pkg-vim-maintainers mailing list