Bram,
2014/7/10(Thu) 3:21:03 UTC+9 Bram Moolenaar:
> Patch 7.4.362
>
> Problem: When matchaddpos() uses a length smaller than the number of bytes
>
> in the (last) character the highlight continues until the end of
>
> the line.
>
> Solution: Change condition from equal to larger-or-equal.
>
> Files: src/screen.c
>
>
>
>
>
> *** ../vim-7.4.361/src/screen.c 2014-07-03 22:54:04.911859458 +0200
>
> --- src/screen.c 2014-07-09 20:14:46.611627298 +0200
>
> ***************
>
> *** 3852,3858 ****
>
> {
>
> shl->attr_cur = shl->attr;
>
> }
>
> ! else if (v == (long)shl->endcol)
>
> {
>
> shl->attr_cur = 0;
>
> next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
>
> --- 3852,3858 ----
>
> {
>
> shl->attr_cur = shl->attr;
>
> }
>
> ! else if (v >= (long)shl->endcol)
>
> {
>
> shl->attr_cur = 0;
>
> next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
>
> *** ../vim-7.4.361/src/version.c 2014-07-09 19:58:21.115647328 +0200
>
> --- src/version.c 2014-07-09 20:20:14.423620635 +0200
>
> ***************
>
> *** 736,737 ****
>
> --- 736,739 ----
>
> { /* Add new patch number below this line */
>
> + /**/
>
> + 362,
>
> /**/
After patch 7.4.362, Processing time is slow under certain conditions.
That condition is 'set hlsearch' and 'set cursorline'.
I've prepared a script file(test603.vim) for verification.
"====================================================
function! T()
call cursor(1, 1)
let t = reltime()
for l in range(1, line('$'))
call cursor(l, 1)
redraw
endfor
echo reltimestr(reltime(t))
endfunction
function! S()
let s = []
for l in range(1, line('$'))
let s += ['\%' . l . 'l\%(abcde\)']
endfor
let @/ = join(s, '\|')
endfunction
:set hlsearch
:set cursorline
:call setline(1, repeat(['abcdef'], 100))
:call S()
:call T()
"====================================================
Exec below.
$ vim -N -u test603.vim
Exec result:
Vim Ver. Elasped time
7.4.131 0.045500
7.4.361 0.046550
7.4.362 1.136427 <-- It is 25 times slower.
7.4.398 1.135489
I think patch 7.4.362 is not enough multi-byte support.
I wrote a patch.
Vim 7.4.404 with my patch elapsed time is 0.053999!
Please check this.
PS
I will send report at a later date about the phenomenon that underline will
remain even after the end of Vim in gnome-terminal, mlterm and xterm.
Thank you.
--
Best regards,
Hirohito Higashi
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r 18fd959b07ef src/screen.c
--- a/src/screen.c Wed Aug 13 22:05:54 2014 +0200
+++ b/src/screen.c Fri Aug 15 23:07:22 2014 +0900
@@ -3856,9 +3856,20 @@
&& v >= (long)shl->startcol
&& v < (long)shl->endcol)
{
+ int vlen;
+
shl->attr_cur = shl->attr;
+#ifdef FEAT_MBYTE
+ if (has_mbyte)
+ {
+ int vlen = (*mb_ptr2len)(line + v);
+
+ if (shl->endcol - shl->startcol < vlen)
+ shl->endcol = shl->startcol + vlen;
+ }
+#endif
}
- else if (v >= (long)shl->endcol)
+ else if (v == (long)shl->endcol)
{
shl->attr_cur = 0;
next_search_hl(wp, shl, lnum, (colnr_T)v, cur);