Hi Bram and Kiichi,

2016-10-15(Sat) 3:41:58 UTC+9 Bram Moolenaar:
> Ozaki Kiichi wrote:
> 
> > This is matchaddpos() problem.
> > 
> > [repro steps]
> > 
> > vim -Nu NONE
> > 
> > i1234567890<Esc>
> > :call matchaddpos('ErrorMsg', [[1, 1, 5], [1, 3, 5]])
> > 
> > expected: colored 1~7 ("12345" and "34567"; pos [1, 1, 5] and [1, 3, 5], 
> > overlapped "345")
> > 
> > actual: colored 1~5 ("12345"; only first pos [1, 1, 5])
> > 
> > This problem occurs when overlapping more than 1 char.
> > e.g. [[1, 1, 5], [1, 5, 5]] is no problem.
> > 
> > [cause]
> > 
> > https://github.com/vim/vim/blob/fd89d7e/src/screen.c#L7770-L7771
> > 
> > On processing second pos [1, 3, 5], mincol is 5 (end of first pos col).
> > Thus, col (== 3) is less then mincol, and second pos is skipped.
> > 
> > I think that the case of "col < mincol < col + len -1" should be also 
> > processed.
> > 
> > [patch]
> > 
> > https://gist.github.com/ichizok/f34c9018f5e9e452d3bc78cc9026a720
> 
> Can you please add a test that fails without the patch?

Here is a test patch.
I confirmed pass the test with Kiichi's patch, and fails without it.
--
Best regards,
Hirohito Higashi (a.k.a. h_east)

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/testdir/test_match.vim b/src/testdir/test_match.vim
index 9ac1db1..20da0db 100644
--- a/src/testdir/test_match.vim
+++ b/src/testdir/test_match.vim
@@ -181,6 +181,16 @@ func Test_matchaddpos()
   redraw!
   call assert_equal(screenattr(2,2), screenattr(1,6))
 
+  " Check overwrapped pos
+  call clearmatches()
+  call setline(1, ['1234567890', 'NH'])
+  call matchaddpos('Error', [[1,1,5], [1,3,5], [2,2]])
+  redraw!
+  call assert_notequal(screenattr(2,2), 0)
+  call assert_equal(screenattr(2,2), screenattr(1,5))
+  call assert_equal(screenattr(2,2), screenattr(1,7))
+  call assert_notequal(screenattr(2,2), screenattr(1,8))
+
   nohl
   syntax off
   set hlsearch&

Raspunde prin e-mail lui