Skip to content
Browse files

fix an error with incorrect highlighting for characterwise selection

  • Loading branch information...
1 parent 6a63707 commit c765c8ed0e7967f9bfb5ae691dc4845f542837e2 @chrisbra committed Dec 10, 2013
Showing with 11 additions and 3 deletions.
  1. +11 −3 autoload/nrrwrgn.vim
View
14 autoload/nrrwrgn.vim
@@ -329,15 +329,23 @@ fun! <sid>GeneratePattern(startl, endl, mode, ...) "{{{1
" This is just a best guess, the highlighted block could still be wrong
" (a " rectangle has been selected, but the complete lines are
" highlighted
- if a:mode ==# '' && a:startl[0] > 0 && a:startl[1] > 0 && block
+ if a:mode ==# '' && a:startl[1] > 0 && a:startl[1] > 0 && block
return '\%>'. (a:startl[0]-1). 'l\&\%>'. (a:startl[1]-1).
\ 'v\&\%<'. (a:endl[0]+1). 'l'
elseif a:mode ==# '' && a:startl[0] > 0 && a:startl[1] > 0
return '\%>'. (a:startl[0]-1). 'l\&\%>'. (a:startl[1]-1).
\ 'v\&\%<'. (a:endl[0]+1). 'l\&\%<'. (a:endl[1]+1). 'v'
elseif a:mode ==# 'v' && a:startl[0] > 0 && a:startl[1] > 0
- return '\%>'. (a:startl[0]-1). 'l\&\%>'. (a:startl[1]-1).
- \ 'v\_.*\%<'. (a:endl[0]+1). 'l\&\%<'. (a:endl[1]+1). 'v'
+ " Need to generate concat 3 patterns:
+ " 1) from startline, startcolumn till end of line
+ " 2) all lines between startline and end line
+ " 3) from start of endline until end column
+ "
+ " example: Start at line 1 col. 6 until line 3 column 12:
+ " \%(\%1l\%>6v.*\)\|\(\%>1l\%<3l.*\)\|\(\%3l.*\%<12v\)
+ return '\%(\%'. (a:startl[0]). 'l\%>'. (a:startl[1]-1). 'v.*\)\|'.
+ \ '\%(\%>'. (a:startl[0]). 'l\%<'. (a:endl[0]). 'l.*\)\|'.
+ \ '\%(\%'. (a:endl[0]). 'l.*\%<'. (a:endl[1]+1). 'v\)'
elseif a:startl[0] > 0
return '\%>'. (a:startl[0]-1). 'l\&\%<'. (a:endl[0]+1). 'l'
else

0 comments on commit c765c8e

Please sign in to comment.
Something went wrong with that request. Please try again.