|
Karsten Hopp |
cd81af |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
cd81af |
Subject: Patch 7.4.330
|
|
Karsten Hopp |
cd81af |
Fcc: outbox
|
|
Karsten Hopp |
cd81af |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
cd81af |
Mime-Version: 1.0
|
|
Karsten Hopp |
cd81af |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
cd81af |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
cd81af |
------------
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
Patch 7.4.330
|
|
Karsten Hopp |
cd81af |
Problem: Using a regexp pattern to highlight a specific position can be
|
|
Karsten Hopp |
cd81af |
slow.
|
|
Karsten Hopp |
cd81af |
Solution: Add matchaddpos() to highlight specific positions efficiently.
|
|
Karsten Hopp |
cd81af |
(Alexey Radkov)
|
|
Karsten Hopp |
cd81af |
Files: runtime/doc/eval.txt, runtime/doc/usr_41.txt,
|
|
Karsten Hopp |
cd81af |
runtime/plugin/matchparen.vim, src/eval.c, src/ex_docmd.c,
|
|
Karsten Hopp |
cd81af |
src/proto/window.pro, src/screen.c, src/structs.h,
|
|
Karsten Hopp |
cd81af |
src/testdir/test63.in, src/testdir/test63.ok, src/window.c
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/runtime/doc/eval.txt 2014-05-28 20:31:37.500292805 +0200
|
|
Karsten Hopp |
cd81af |
--- runtime/doc/eval.txt 2014-06-17 16:31:35.572453748 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 1887,1892 ****
|
|
Karsten Hopp |
cd81af |
--- 1887,1894 ----
|
|
Karsten Hopp |
cd81af |
Number position where {pat} matches in {expr}
|
|
Karsten Hopp |
cd81af |
matchadd( {group}, {pattern}[, {priority}[, {id}]])
|
|
Karsten Hopp |
cd81af |
Number highlight {pattern} with {group}
|
|
Karsten Hopp |
cd81af |
+ matchaddpos( {group}, {list}[, {priority}[, {id}]])
|
|
Karsten Hopp |
cd81af |
+ Number highlight positions with {group}
|
|
Karsten Hopp |
cd81af |
matcharg( {nr}) List arguments of |:match|
|
|
Karsten Hopp |
cd81af |
matchdelete( {id}) Number delete match identified by {id}
|
|
Karsten Hopp |
cd81af |
matchend( {expr}, {pat}[, {start}[, {count}]])
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 4342,4347 ****
|
|
Karsten Hopp |
cd81af |
--- 4382,4422 ----
|
|
Karsten Hopp |
cd81af |
available from |getmatches()|. All matches can be deleted in
|
|
Karsten Hopp |
cd81af |
one operation by |clearmatches()|.
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
+ matchaddpos({group}, {pos}[, {priority}[, {id}]]) *matchaddpos()*
|
|
Karsten Hopp |
cd81af |
+ Same as |matchadd()|, but requires a list of positions {pos}
|
|
Karsten Hopp |
cd81af |
+ instead of a pattern. This command is faster than |matchadd()|
|
|
Karsten Hopp |
cd81af |
+ because it does not require to handle regular expressions and
|
|
Karsten Hopp |
cd81af |
+ sets buffer line boundaries to redraw screen. It is supposed
|
|
Karsten Hopp |
cd81af |
+ to be used when fast match additions and deletions are
|
|
Karsten Hopp |
cd81af |
+ required, for example to highlight matching parentheses.
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ The list {pos} can contain one of these items:
|
|
Karsten Hopp |
cd81af |
+ - A number. This while line will be highlighted. The first
|
|
Karsten Hopp |
cd81af |
+ line has number 1.
|
|
Karsten Hopp |
cd81af |
+ - A list with one number, e.g., [23]. The whole line with this
|
|
Karsten Hopp |
cd81af |
+ number will be highlighted.
|
|
Karsten Hopp |
cd81af |
+ - A list with two numbers, e.g., [23, 11]. The first number is
|
|
Karsten Hopp |
cd81af |
+ the line number, the second one the column number (first
|
|
Karsten Hopp |
cd81af |
+ column is 1). The character at this position will be
|
|
Karsten Hopp |
cd81af |
+ highlighted.
|
|
Karsten Hopp |
cd81af |
+ - A list with three numbers, e.g., [23, 11, 3]. As above, but
|
|
Karsten Hopp |
cd81af |
+ the third number gives the length of the highlight in screen
|
|
Karsten Hopp |
cd81af |
+ cells.
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ The maximum number of positions is 8.
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ Example: >
|
|
Karsten Hopp |
cd81af |
+ :highlight MyGroup ctermbg=green guibg=green
|
|
Karsten Hopp |
cd81af |
+ :let m = matchaddpos("MyGroup", [[23, 24], 34])
|
|
Karsten Hopp |
cd81af |
+ < Deletion of the pattern: >
|
|
Karsten Hopp |
cd81af |
+ :call matchdelete(m)
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ < Matches added by |matchaddpos()| are returned by
|
|
Karsten Hopp |
cd81af |
+ |getmatches()| with an entry "pos1", "pos2", etc., with the
|
|
Karsten Hopp |
cd81af |
+ value a list like the {pos} item.
|
|
Karsten Hopp |
cd81af |
+ These matches cannot be set via |setmatches()|, however they
|
|
Karsten Hopp |
cd81af |
+ can still be deleted by |clearmatches()|.
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
matcharg({nr}) *matcharg()*
|
|
Karsten Hopp |
cd81af |
Selects the {nr} match item, as set with a |:match|,
|
|
Karsten Hopp |
cd81af |
|:2match| or |:3match| command.
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/runtime/doc/usr_41.txt 2014-05-28 18:22:37.872225054 +0200
|
|
Karsten Hopp |
cd81af |
--- runtime/doc/usr_41.txt 2014-06-17 14:06:44.836124965 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 824,829 ****
|
|
Karsten Hopp |
cd81af |
--- 827,833 ----
|
|
Karsten Hopp |
cd81af |
synconcealed() get info about concealing
|
|
Karsten Hopp |
cd81af |
diff_hlID() get highlight ID for diff mode at a position
|
|
Karsten Hopp |
cd81af |
matchadd() define a pattern to highlight (a "match")
|
|
Karsten Hopp |
cd81af |
+ matchaddpos() define a list of positions to highlight
|
|
Karsten Hopp |
cd81af |
matcharg() get info about |:match| arguments
|
|
Karsten Hopp |
cd81af |
matchdelete() delete a match defined by |matchadd()| or a
|
|
Karsten Hopp |
cd81af |
|:match| command
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/runtime/plugin/matchparen.vim 2013-05-08 05:15:53.000000000 +0200
|
|
Karsten Hopp |
cd81af |
--- runtime/plugin/matchparen.vim 2014-06-17 14:14:45.712143158 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 1,6 ****
|
|
Karsten Hopp |
cd81af |
" Vim plugin for showing matching parens
|
|
Karsten Hopp |
cd81af |
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
|
Karsten Hopp |
cd81af |
! " Last Change: 2013 May 08
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
" Exit quickly when:
|
|
Karsten Hopp |
cd81af |
" - this plugin was already loaded (or disabled)
|
|
Karsten Hopp |
cd81af |
--- 1,6 ----
|
|
Karsten Hopp |
cd81af |
" Vim plugin for showing matching parens
|
|
Karsten Hopp |
cd81af |
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
|
Karsten Hopp |
cd81af |
! " Last Change: 2014 Jun 17
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
" Exit quickly when:
|
|
Karsten Hopp |
cd81af |
" - this plugin was already loaded (or disabled)
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 39,45 ****
|
|
Karsten Hopp |
cd81af |
function! s:Highlight_Matching_Pair()
|
|
Karsten Hopp |
cd81af |
" Remove any previous match.
|
|
Karsten Hopp |
cd81af |
if exists('w:paren_hl_on') && w:paren_hl_on
|
|
Karsten Hopp |
cd81af |
! 3match none
|
|
Karsten Hopp |
cd81af |
let w:paren_hl_on = 0
|
|
Karsten Hopp |
cd81af |
endif
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
--- 39,45 ----
|
|
Karsten Hopp |
cd81af |
function! s:Highlight_Matching_Pair()
|
|
Karsten Hopp |
cd81af |
" Remove any previous match.
|
|
Karsten Hopp |
cd81af |
if exists('w:paren_hl_on') && w:paren_hl_on
|
|
Karsten Hopp |
cd81af |
! silent! call matchdelete(3)
|
|
Karsten Hopp |
cd81af |
let w:paren_hl_on = 0
|
|
Karsten Hopp |
cd81af |
endif
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 152,165 ****
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
" If a match is found setup match highlighting.
|
|
Karsten Hopp |
cd81af |
if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom
|
|
Karsten Hopp |
cd81af |
! exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) .
|
|
Karsten Hopp |
cd81af |
! \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
|
|
Karsten Hopp |
cd81af |
let w:paren_hl_on = 1
|
|
Karsten Hopp |
cd81af |
endif
|
|
Karsten Hopp |
cd81af |
endfunction
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
" Define commands that will disable and enable the plugin.
|
|
Karsten Hopp |
cd81af |
! command! NoMatchParen windo 3match none | unlet! g:loaded_matchparen |
|
|
Karsten Hopp |
cd81af |
\ au! matchparen
|
|
Karsten Hopp |
cd81af |
command! DoMatchParen runtime plugin/matchparen.vim | windo doau CursorMoved
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
--- 152,169 ----
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
" If a match is found setup match highlighting.
|
|
Karsten Hopp |
cd81af |
if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom
|
|
Karsten Hopp |
cd81af |
! if exists('*matchaddpos')
|
|
Karsten Hopp |
cd81af |
! call matchaddpos('MatchParen', [[c_lnum, c_col - before], [m_lnum, m_col]], 10, 3)
|
|
Karsten Hopp |
cd81af |
! else
|
|
Karsten Hopp |
cd81af |
! exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) .
|
|
Karsten Hopp |
cd81af |
! \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
|
|
Karsten Hopp |
cd81af |
! endif
|
|
Karsten Hopp |
cd81af |
let w:paren_hl_on = 1
|
|
Karsten Hopp |
cd81af |
endif
|
|
Karsten Hopp |
cd81af |
endfunction
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
" Define commands that will disable and enable the plugin.
|
|
Karsten Hopp |
cd81af |
! command! NoMatchParen windo silent! call matchdelete(3) | unlet! g:loaded_matchparen |
|
|
Karsten Hopp |
cd81af |
\ au! matchparen
|
|
Karsten Hopp |
cd81af |
command! DoMatchParen runtime plugin/matchparen.vim | windo doau CursorMoved
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/src/eval.c 2014-06-17 12:51:13.207953527 +0200
|
|
Karsten Hopp |
cd81af |
--- src/eval.c 2014-06-17 17:02:25.388523729 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 622,627 ****
|
|
Karsten Hopp |
cd81af |
--- 622,628 ----
|
|
Karsten Hopp |
cd81af |
static void f_mapcheck __ARGS((typval_T *argvars, typval_T *rettv));
|
|
Karsten Hopp |
cd81af |
static void f_match __ARGS((typval_T *argvars, typval_T *rettv));
|
|
Karsten Hopp |
cd81af |
static void f_matchadd __ARGS((typval_T *argvars, typval_T *rettv));
|
|
Karsten Hopp |
cd81af |
+ static void f_matchaddpos __ARGS((typval_T *argvars, typval_T *rettv));
|
|
Karsten Hopp |
cd81af |
static void f_matcharg __ARGS((typval_T *argvars, typval_T *rettv));
|
|
Karsten Hopp |
cd81af |
static void f_matchdelete __ARGS((typval_T *argvars, typval_T *rettv));
|
|
Karsten Hopp |
cd81af |
static void f_matchend __ARGS((typval_T *argvars, typval_T *rettv));
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 8054,8059 ****
|
|
Karsten Hopp |
cd81af |
--- 8055,8061 ----
|
|
Karsten Hopp |
cd81af |
{"mapcheck", 1, 3, f_mapcheck},
|
|
Karsten Hopp |
cd81af |
{"match", 2, 4, f_match},
|
|
Karsten Hopp |
cd81af |
{"matchadd", 2, 4, f_matchadd},
|
|
Karsten Hopp |
cd81af |
+ {"matchaddpos", 2, 4, f_matchaddpos},
|
|
Karsten Hopp |
cd81af |
{"matcharg", 1, 1, f_matcharg},
|
|
Karsten Hopp |
cd81af |
{"matchdelete", 1, 1, f_matchdelete},
|
|
Karsten Hopp |
cd81af |
{"matchend", 2, 4, f_matchend},
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 11767,11772 ****
|
|
Karsten Hopp |
cd81af |
--- 11769,11775 ----
|
|
Karsten Hopp |
cd81af |
#ifdef FEAT_SEARCH_EXTRA
|
|
Karsten Hopp |
cd81af |
dict_T *dict;
|
|
Karsten Hopp |
cd81af |
matchitem_T *cur = curwin->w_match_head;
|
|
Karsten Hopp |
cd81af |
+ int i;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
if (rettv_list_alloc(rettv) == OK)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 11775,11782 ****
|
|
Karsten Hopp |
cd81af |
dict = dict_alloc();
|
|
Karsten Hopp |
cd81af |
if (dict == NULL)
|
|
Karsten Hopp |
cd81af |
return;
|
|
Karsten Hopp |
cd81af |
dict_add_nr_str(dict, "group", 0L, syn_id2name(cur->hlg_id));
|
|
Karsten Hopp |
cd81af |
- dict_add_nr_str(dict, "pattern", 0L, cur->pattern);
|
|
Karsten Hopp |
cd81af |
dict_add_nr_str(dict, "priority", (long)cur->priority, NULL);
|
|
Karsten Hopp |
cd81af |
dict_add_nr_str(dict, "id", (long)cur->id, NULL);
|
|
Karsten Hopp |
cd81af |
list_append_dict(rettv->vval.v_list, dict);
|
|
Karsten Hopp |
cd81af |
--- 11778,11813 ----
|
|
Karsten Hopp |
cd81af |
dict = dict_alloc();
|
|
Karsten Hopp |
cd81af |
if (dict == NULL)
|
|
Karsten Hopp |
cd81af |
return;
|
|
Karsten Hopp |
cd81af |
+ if (cur->match.regprog == NULL)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ /* match added with matchaddpos() */
|
|
Karsten Hopp |
cd81af |
+ for (i = 0; i < MAXPOSMATCH; ++i)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ llpos_T *llpos;
|
|
Karsten Hopp |
cd81af |
+ char buf[6];
|
|
Karsten Hopp |
cd81af |
+ list_T *l;
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ llpos = &cur->pos.pos[i];
|
|
Karsten Hopp |
cd81af |
+ if (llpos->lnum == 0)
|
|
Karsten Hopp |
cd81af |
+ break;
|
|
Karsten Hopp |
cd81af |
+ l = list_alloc();
|
|
Karsten Hopp |
cd81af |
+ if (l == NULL)
|
|
Karsten Hopp |
cd81af |
+ break;
|
|
Karsten Hopp |
cd81af |
+ list_append_number(l, (varnumber_T)llpos->lnum);
|
|
Karsten Hopp |
cd81af |
+ if (llpos->col > 0)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ list_append_number(l, (varnumber_T)llpos->col);
|
|
Karsten Hopp |
cd81af |
+ list_append_number(l, (varnumber_T)llpos->len);
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ sprintf(buf, "pos%d", i + 1);
|
|
Karsten Hopp |
cd81af |
+ dict_add_list(dict, buf, l);
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ else
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ dict_add_nr_str(dict, "pattern", 0L, cur->pattern);
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
dict_add_nr_str(dict, "group", 0L, syn_id2name(cur->hlg_id));
|
|
Karsten Hopp |
cd81af |
dict_add_nr_str(dict, "priority", (long)cur->priority, NULL);
|
|
Karsten Hopp |
cd81af |
dict_add_nr_str(dict, "id", (long)cur->id, NULL);
|
|
Karsten Hopp |
cd81af |
list_append_dict(rettv->vval.v_list, dict);
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 14313,14319 ****
|
|
Karsten Hopp |
cd81af |
return;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
! rettv->vval.v_number = match_add(curwin, grp, pat, prio, id);
|
|
Karsten Hopp |
cd81af |
#endif
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
--- 14344,14401 ----
|
|
Karsten Hopp |
cd81af |
return;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
! rettv->vval.v_number = match_add(curwin, grp, pat, prio, id, NULL);
|
|
Karsten Hopp |
cd81af |
! #endif
|
|
Karsten Hopp |
cd81af |
! }
|
|
Karsten Hopp |
cd81af |
!
|
|
Karsten Hopp |
cd81af |
! /*
|
|
Karsten Hopp |
cd81af |
! * "matchaddpos()" function
|
|
Karsten Hopp |
cd81af |
! */
|
|
Karsten Hopp |
cd81af |
! static void
|
|
Karsten Hopp |
cd81af |
! f_matchaddpos(argvars, rettv)
|
|
Karsten Hopp |
cd81af |
! typval_T *argvars UNUSED;
|
|
Karsten Hopp |
cd81af |
! typval_T *rettv UNUSED;
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! #ifdef FEAT_SEARCH_EXTRA
|
|
Karsten Hopp |
cd81af |
! char_u buf[NUMBUFLEN];
|
|
Karsten Hopp |
cd81af |
! char_u *group;
|
|
Karsten Hopp |
cd81af |
! int prio = 10;
|
|
Karsten Hopp |
cd81af |
! int id = -1;
|
|
Karsten Hopp |
cd81af |
! int error = FALSE;
|
|
Karsten Hopp |
cd81af |
! list_T *l;
|
|
Karsten Hopp |
cd81af |
!
|
|
Karsten Hopp |
cd81af |
! rettv->vval.v_number = -1;
|
|
Karsten Hopp |
cd81af |
!
|
|
Karsten Hopp |
cd81af |
! group = get_tv_string_buf_chk(&argvars[0], buf);
|
|
Karsten Hopp |
cd81af |
! if (group == NULL)
|
|
Karsten Hopp |
cd81af |
! return;
|
|
Karsten Hopp |
cd81af |
!
|
|
Karsten Hopp |
cd81af |
! if (argvars[1].v_type != VAR_LIST)
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! EMSG2(_(e_listarg), "matchaddpos()");
|
|
Karsten Hopp |
cd81af |
! return;
|
|
Karsten Hopp |
cd81af |
! }
|
|
Karsten Hopp |
cd81af |
! l = argvars[1].vval.v_list;
|
|
Karsten Hopp |
cd81af |
! if (l == NULL)
|
|
Karsten Hopp |
cd81af |
! return;
|
|
Karsten Hopp |
cd81af |
!
|
|
Karsten Hopp |
cd81af |
! if (argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! prio = get_tv_number_chk(&argvars[2], &error);
|
|
Karsten Hopp |
cd81af |
! if (argvars[3].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
cd81af |
! id = get_tv_number_chk(&argvars[3], &error);
|
|
Karsten Hopp |
cd81af |
! }
|
|
Karsten Hopp |
cd81af |
! if (error == TRUE)
|
|
Karsten Hopp |
cd81af |
! return;
|
|
Karsten Hopp |
cd81af |
!
|
|
Karsten Hopp |
cd81af |
! /* id == 3 is ok because matchaddpos() is supposed to substitute :3match */
|
|
Karsten Hopp |
cd81af |
! if (id == 1 || id == 2)
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! EMSGN("E798: ID is reserved for \":match\": %ld", id);
|
|
Karsten Hopp |
cd81af |
! return;
|
|
Karsten Hopp |
cd81af |
! }
|
|
Karsten Hopp |
cd81af |
!
|
|
Karsten Hopp |
cd81af |
! rettv->vval.v_number = match_add(curwin, group, NULL, prio, id, l);
|
|
Karsten Hopp |
cd81af |
#endif
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 16816,16822 ****
|
|
Karsten Hopp |
cd81af |
match_add(curwin, get_dict_string(d, (char_u *)"group", FALSE),
|
|
Karsten Hopp |
cd81af |
get_dict_string(d, (char_u *)"pattern", FALSE),
|
|
Karsten Hopp |
cd81af |
(int)get_dict_number(d, (char_u *)"priority"),
|
|
Karsten Hopp |
cd81af |
! (int)get_dict_number(d, (char_u *)"id"));
|
|
Karsten Hopp |
cd81af |
li = li->li_next;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
rettv->vval.v_number = 0;
|
|
Karsten Hopp |
cd81af |
--- 16898,16904 ----
|
|
Karsten Hopp |
cd81af |
match_add(curwin, get_dict_string(d, (char_u *)"group", FALSE),
|
|
Karsten Hopp |
cd81af |
get_dict_string(d, (char_u *)"pattern", FALSE),
|
|
Karsten Hopp |
cd81af |
(int)get_dict_number(d, (char_u *)"priority"),
|
|
Karsten Hopp |
cd81af |
! (int)get_dict_number(d, (char_u *)"id"), NULL);
|
|
Karsten Hopp |
cd81af |
li = li->li_next;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
rettv->vval.v_number = 0;
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/src/ex_docmd.c 2014-05-28 18:22:37.876225054 +0200
|
|
Karsten Hopp |
cd81af |
--- src/ex_docmd.c 2014-06-17 14:06:44.844124966 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 11489,11495 ****
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
c = *end;
|
|
Karsten Hopp |
cd81af |
*end = NUL;
|
|
Karsten Hopp |
cd81af |
! match_add(curwin, g, p + 1, 10, id);
|
|
Karsten Hopp |
cd81af |
vim_free(g);
|
|
Karsten Hopp |
cd81af |
*end = c;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
--- 11489,11495 ----
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
c = *end;
|
|
Karsten Hopp |
cd81af |
*end = NUL;
|
|
Karsten Hopp |
cd81af |
! match_add(curwin, g, p + 1, 10, id, NULL);
|
|
Karsten Hopp |
cd81af |
vim_free(g);
|
|
Karsten Hopp |
cd81af |
*end = c;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/src/proto/window.pro 2013-08-14 17:11:14.000000000 +0200
|
|
Karsten Hopp |
cd81af |
--- src/proto/window.pro 2014-06-17 14:06:44.844124966 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 75,81 ****
|
|
Karsten Hopp |
cd81af |
void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
|
|
Karsten Hopp |
cd81af |
void restore_buffer __ARGS((buf_T *save_curbuf));
|
|
Karsten Hopp |
cd81af |
int win_hasvertsplit __ARGS((void));
|
|
Karsten Hopp |
cd81af |
! int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id));
|
|
Karsten Hopp |
cd81af |
int match_delete __ARGS((win_T *wp, int id, int perr));
|
|
Karsten Hopp |
cd81af |
void clear_matches __ARGS((win_T *wp));
|
|
Karsten Hopp |
cd81af |
matchitem_T *get_match __ARGS((win_T *wp, int id));
|
|
Karsten Hopp |
cd81af |
--- 75,81 ----
|
|
Karsten Hopp |
cd81af |
void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
|
|
Karsten Hopp |
cd81af |
void restore_buffer __ARGS((buf_T *save_curbuf));
|
|
Karsten Hopp |
cd81af |
int win_hasvertsplit __ARGS((void));
|
|
Karsten Hopp |
cd81af |
! int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos));
|
|
Karsten Hopp |
cd81af |
int match_delete __ARGS((win_T *wp, int id, int perr));
|
|
Karsten Hopp |
cd81af |
void clear_matches __ARGS((win_T *wp));
|
|
Karsten Hopp |
cd81af |
matchitem_T *get_match __ARGS((win_T *wp, int id));
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/src/screen.c 2014-05-28 21:40:47.092329130 +0200
|
|
Karsten Hopp |
cd81af |
--- src/screen.c 2014-06-17 17:04:08.064527614 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 144,150 ****
|
|
Karsten Hopp |
cd81af |
static void end_search_hl __ARGS((void));
|
|
Karsten Hopp |
cd81af |
static void init_search_hl __ARGS((win_T *wp));
|
|
Karsten Hopp |
cd81af |
static void prepare_search_hl __ARGS((win_T *wp, linenr_T lnum));
|
|
Karsten Hopp |
cd81af |
! static void next_search_hl __ARGS((win_T *win, match_T *shl, linenr_T lnum, colnr_T mincol));
|
|
Karsten Hopp |
cd81af |
#endif
|
|
Karsten Hopp |
cd81af |
static void screen_start_highlight __ARGS((int attr));
|
|
Karsten Hopp |
cd81af |
static void screen_char __ARGS((unsigned off, int row, int col));
|
|
Karsten Hopp |
cd81af |
--- 144,151 ----
|
|
Karsten Hopp |
cd81af |
static void end_search_hl __ARGS((void));
|
|
Karsten Hopp |
cd81af |
static void init_search_hl __ARGS((win_T *wp));
|
|
Karsten Hopp |
cd81af |
static void prepare_search_hl __ARGS((win_T *wp, linenr_T lnum));
|
|
Karsten Hopp |
cd81af |
! static void next_search_hl __ARGS((win_T *win, match_T *shl, linenr_T lnum, colnr_T mincol, matchitem_T *cur));
|
|
Karsten Hopp |
cd81af |
! static int next_search_hl_pos __ARGS((match_T *shl, linenr_T lnum, posmatch_T *pos, colnr_T mincol));
|
|
Karsten Hopp |
cd81af |
#endif
|
|
Karsten Hopp |
cd81af |
static void screen_start_highlight __ARGS((int attr));
|
|
Karsten Hopp |
cd81af |
static void screen_char __ARGS((unsigned off, int row, int col));
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 2929,2934 ****
|
|
Karsten Hopp |
cd81af |
--- 2930,2937 ----
|
|
Karsten Hopp |
cd81af |
match_T *shl; /* points to search_hl or a match */
|
|
Karsten Hopp |
cd81af |
int shl_flag; /* flag to indicate whether search_hl
|
|
Karsten Hopp |
cd81af |
has been processed or not */
|
|
Karsten Hopp |
cd81af |
+ int pos_inprogress; /* marks that position match search is
|
|
Karsten Hopp |
cd81af |
+ in progress */
|
|
Karsten Hopp |
cd81af |
int prevcol_hl_flag; /* flag to indicate whether prevcol
|
|
Karsten Hopp |
cd81af |
equals startcol of search_hl or one
|
|
Karsten Hopp |
cd81af |
of the matches */
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 3439,3482 ****
|
|
Karsten Hopp |
cd81af |
shl->startcol = MAXCOL;
|
|
Karsten Hopp |
cd81af |
shl->endcol = MAXCOL;
|
|
Karsten Hopp |
cd81af |
shl->attr_cur = 0;
|
|
Karsten Hopp |
cd81af |
! if (shl->rm.regprog != NULL)
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! v = (long)(ptr - line);
|
|
Karsten Hopp |
cd81af |
! next_search_hl(wp, shl, lnum, (colnr_T)v);
|
|
Karsten Hopp |
cd81af |
!
|
|
Karsten Hopp |
cd81af |
! /* Need to get the line again, a multi-line regexp may have made it
|
|
Karsten Hopp |
cd81af |
! * invalid. */
|
|
Karsten Hopp |
cd81af |
! line = ml_get_buf(wp->w_buffer, lnum, FALSE);
|
|
Karsten Hopp |
cd81af |
! ptr = line + v;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
! if (shl->lnum != 0 && shl->lnum <= lnum)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
- if (shl->lnum == lnum)
|
|
Karsten Hopp |
cd81af |
- shl->startcol = shl->rm.startpos[0].col;
|
|
Karsten Hopp |
cd81af |
- else
|
|
Karsten Hopp |
cd81af |
- shl->startcol = 0;
|
|
Karsten Hopp |
cd81af |
- if (lnum == shl->lnum + shl->rm.endpos[0].lnum
|
|
Karsten Hopp |
cd81af |
- - shl->rm.startpos[0].lnum)
|
|
Karsten Hopp |
cd81af |
- shl->endcol = shl->rm.endpos[0].col;
|
|
Karsten Hopp |
cd81af |
- else
|
|
Karsten Hopp |
cd81af |
- shl->endcol = MAXCOL;
|
|
Karsten Hopp |
cd81af |
- /* Highlight one character for an empty match. */
|
|
Karsten Hopp |
cd81af |
- if (shl->startcol == shl->endcol)
|
|
Karsten Hopp |
cd81af |
- {
|
|
Karsten Hopp |
cd81af |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
cd81af |
! if (has_mbyte && line[shl->endcol] != NUL)
|
|
Karsten Hopp |
cd81af |
! shl->endcol += (*mb_ptr2len)(line + shl->endcol);
|
|
Karsten Hopp |
cd81af |
! else
|
|
Karsten Hopp |
cd81af |
#endif
|
|
Karsten Hopp |
cd81af |
! ++shl->endcol;
|
|
Karsten Hopp |
cd81af |
! }
|
|
Karsten Hopp |
cd81af |
! if ((long)shl->startcol < v) /* match at leftcol */
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! shl->attr_cur = shl->attr;
|
|
Karsten Hopp |
cd81af |
! search_attr = shl->attr;
|
|
Karsten Hopp |
cd81af |
! }
|
|
Karsten Hopp |
cd81af |
! area_highlighting = TRUE;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
if (shl != &search_hl && cur != NULL)
|
|
Karsten Hopp |
cd81af |
cur = cur->next;
|
|
Karsten Hopp |
cd81af |
--- 3442,3484 ----
|
|
Karsten Hopp |
cd81af |
shl->startcol = MAXCOL;
|
|
Karsten Hopp |
cd81af |
shl->endcol = MAXCOL;
|
|
Karsten Hopp |
cd81af |
shl->attr_cur = 0;
|
|
Karsten Hopp |
cd81af |
! v = (long)(ptr - line);
|
|
Karsten Hopp |
cd81af |
! if (cur != NULL)
|
|
Karsten Hopp |
cd81af |
! cur->pos.cur = 0;
|
|
Karsten Hopp |
cd81af |
! next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
|
|
Karsten Hopp |
cd81af |
!
|
|
Karsten Hopp |
cd81af |
! /* Need to get the line again, a multi-line regexp may have made it
|
|
Karsten Hopp |
cd81af |
! * invalid. */
|
|
Karsten Hopp |
cd81af |
! line = ml_get_buf(wp->w_buffer, lnum, FALSE);
|
|
Karsten Hopp |
cd81af |
! ptr = line + v;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
! if (shl->lnum != 0 && shl->lnum <= lnum)
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! if (shl->lnum == lnum)
|
|
Karsten Hopp |
cd81af |
! shl->startcol = shl->rm.startpos[0].col;
|
|
Karsten Hopp |
cd81af |
! else
|
|
Karsten Hopp |
cd81af |
! shl->startcol = 0;
|
|
Karsten Hopp |
cd81af |
! if (lnum == shl->lnum + shl->rm.endpos[0].lnum
|
|
Karsten Hopp |
cd81af |
! - shl->rm.startpos[0].lnum)
|
|
Karsten Hopp |
cd81af |
! shl->endcol = shl->rm.endpos[0].col;
|
|
Karsten Hopp |
cd81af |
! else
|
|
Karsten Hopp |
cd81af |
! shl->endcol = MAXCOL;
|
|
Karsten Hopp |
cd81af |
! /* Highlight one character for an empty match. */
|
|
Karsten Hopp |
cd81af |
! if (shl->startcol == shl->endcol)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
cd81af |
! if (has_mbyte && line[shl->endcol] != NUL)
|
|
Karsten Hopp |
cd81af |
! shl->endcol += (*mb_ptr2len)(line + shl->endcol);
|
|
Karsten Hopp |
cd81af |
! else
|
|
Karsten Hopp |
cd81af |
#endif
|
|
Karsten Hopp |
cd81af |
! ++shl->endcol;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
+ if ((long)shl->startcol < v) /* match at leftcol */
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ shl->attr_cur = shl->attr;
|
|
Karsten Hopp |
cd81af |
+ search_attr = shl->attr;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ area_highlighting = TRUE;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
if (shl != &search_hl && cur != NULL)
|
|
Karsten Hopp |
cd81af |
cur = cur->next;
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 3488,3494 ****
|
|
Karsten Hopp |
cd81af |
* when Visual mode is active, because it's not clear what is selected
|
|
Karsten Hopp |
cd81af |
* then. */
|
|
Karsten Hopp |
cd81af |
if (wp->w_p_cul && lnum == wp->w_cursor.lnum
|
|
Karsten Hopp |
cd81af |
! && !(wp == curwin && VIsual_active))
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
line_attr = hl_attr(HLF_CUL);
|
|
Karsten Hopp |
cd81af |
area_highlighting = TRUE;
|
|
Karsten Hopp |
cd81af |
--- 3490,3496 ----
|
|
Karsten Hopp |
cd81af |
* when Visual mode is active, because it's not clear what is selected
|
|
Karsten Hopp |
cd81af |
* then. */
|
|
Karsten Hopp |
cd81af |
if (wp->w_p_cul && lnum == wp->w_cursor.lnum
|
|
Karsten Hopp |
cd81af |
! && !(wp == curwin && VIsual_active))
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
line_attr = hl_attr(HLF_CUL);
|
|
Karsten Hopp |
cd81af |
area_highlighting = TRUE;
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 3792,3798 ****
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
else
|
|
Karsten Hopp |
cd81af |
shl = &cur->hl;
|
|
Karsten Hopp |
cd81af |
! while (shl->rm.regprog != NULL)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
if (shl->startcol != MAXCOL
|
|
Karsten Hopp |
cd81af |
&& v >= (long)shl->startcol
|
|
Karsten Hopp |
cd81af |
--- 3794,3804 ----
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
else
|
|
Karsten Hopp |
cd81af |
shl = &cur->hl;
|
|
Karsten Hopp |
cd81af |
! if (cur != NULL)
|
|
Karsten Hopp |
cd81af |
! cur->pos.cur = 0;
|
|
Karsten Hopp |
cd81af |
! pos_inprogress = TRUE;
|
|
Karsten Hopp |
cd81af |
! while (shl->rm.regprog != NULL
|
|
Karsten Hopp |
cd81af |
! || (cur != NULL && pos_inprogress))
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
if (shl->startcol != MAXCOL
|
|
Karsten Hopp |
cd81af |
&& v >= (long)shl->startcol
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 3803,3810 ****
|
|
Karsten Hopp |
cd81af |
else if (v == (long)shl->endcol)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
shl->attr_cur = 0;
|
|
Karsten Hopp |
cd81af |
!
|
|
Karsten Hopp |
cd81af |
! next_search_hl(wp, shl, lnum, (colnr_T)v);
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
/* Need to get the line again, a multi-line regexp
|
|
Karsten Hopp |
cd81af |
* may have made it invalid. */
|
|
Karsten Hopp |
cd81af |
--- 3809,3817 ----
|
|
Karsten Hopp |
cd81af |
else if (v == (long)shl->endcol)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
shl->attr_cur = 0;
|
|
Karsten Hopp |
cd81af |
! next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
|
|
Karsten Hopp |
cd81af |
! pos_inprogress = cur == NULL || cur->pos.cur == 0
|
|
Karsten Hopp |
cd81af |
! ? FALSE : TRUE;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
/* Need to get the line again, a multi-line regexp
|
|
Karsten Hopp |
cd81af |
* may have made it invalid. */
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 7277,7282 ****
|
|
Karsten Hopp |
cd81af |
--- 7284,7291 ----
|
|
Karsten Hopp |
cd81af |
match_T *shl; /* points to search_hl or a match */
|
|
Karsten Hopp |
cd81af |
int shl_flag; /* flag to indicate whether search_hl
|
|
Karsten Hopp |
cd81af |
has been processed or not */
|
|
Karsten Hopp |
cd81af |
+ int pos_inprogress; /* marks that position match search is
|
|
Karsten Hopp |
cd81af |
+ in progress */
|
|
Karsten Hopp |
cd81af |
int n;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
/*
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 7311,7320 ****
|
|
Karsten Hopp |
cd81af |
shl->first_lnum = wp->w_topline;
|
|
Karsten Hopp |
cd81af |
# endif
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
n = 0;
|
|
Karsten Hopp |
cd81af |
! while (shl->first_lnum < lnum && shl->rm.regprog != NULL)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
! next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n);
|
|
Karsten Hopp |
cd81af |
if (shl->lnum != 0)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
shl->first_lnum = shl->lnum
|
|
Karsten Hopp |
cd81af |
--- 7320,7335 ----
|
|
Karsten Hopp |
cd81af |
shl->first_lnum = wp->w_topline;
|
|
Karsten Hopp |
cd81af |
# endif
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
+ if (cur != NULL)
|
|
Karsten Hopp |
cd81af |
+ cur->pos.cur = 0;
|
|
Karsten Hopp |
cd81af |
+ pos_inprogress = TRUE;
|
|
Karsten Hopp |
cd81af |
n = 0;
|
|
Karsten Hopp |
cd81af |
! while (shl->first_lnum < lnum && (shl->rm.regprog != NULL
|
|
Karsten Hopp |
cd81af |
! || (cur != NULL && pos_inprogress)))
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
! next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n, cur);
|
|
Karsten Hopp |
cd81af |
! pos_inprogress = cur == NULL || cur->pos.cur == 0
|
|
Karsten Hopp |
cd81af |
! ? FALSE : TRUE;
|
|
Karsten Hopp |
cd81af |
if (shl->lnum != 0)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
shl->first_lnum = shl->lnum
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 7343,7353 ****
|
|
Karsten Hopp |
cd81af |
* Careful: Any pointers for buffer lines will become invalid.
|
|
Karsten Hopp |
cd81af |
*/
|
|
Karsten Hopp |
cd81af |
static void
|
|
Karsten Hopp |
cd81af |
! next_search_hl(win, shl, lnum, mincol)
|
|
Karsten Hopp |
cd81af |
! win_T *win;
|
|
Karsten Hopp |
cd81af |
! match_T *shl; /* points to search_hl or a match */
|
|
Karsten Hopp |
cd81af |
! linenr_T lnum;
|
|
Karsten Hopp |
cd81af |
! colnr_T mincol; /* minimal column for a match */
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
linenr_T l;
|
|
Karsten Hopp |
cd81af |
colnr_T matchcol;
|
|
Karsten Hopp |
cd81af |
--- 7358,7369 ----
|
|
Karsten Hopp |
cd81af |
* Careful: Any pointers for buffer lines will become invalid.
|
|
Karsten Hopp |
cd81af |
*/
|
|
Karsten Hopp |
cd81af |
static void
|
|
Karsten Hopp |
cd81af |
! next_search_hl(win, shl, lnum, mincol, cur)
|
|
Karsten Hopp |
cd81af |
! win_T *win;
|
|
Karsten Hopp |
cd81af |
! match_T *shl; /* points to search_hl or a match */
|
|
Karsten Hopp |
cd81af |
! linenr_T lnum;
|
|
Karsten Hopp |
cd81af |
! colnr_T mincol; /* minimal column for a match */
|
|
Karsten Hopp |
cd81af |
! matchitem_T *cur; /* to retrieve match postions if any */
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
linenr_T l;
|
|
Karsten Hopp |
cd81af |
colnr_T matchcol;
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 7415,7440 ****
|
|
Karsten Hopp |
cd81af |
matchcol = shl->rm.endpos[0].col;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
shl->lnum = lnum;
|
|
Karsten Hopp |
cd81af |
! nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol,
|
|
Karsten Hopp |
cd81af |
#ifdef FEAT_RELTIME
|
|
Karsten Hopp |
cd81af |
! &(shl->tm)
|
|
Karsten Hopp |
cd81af |
#else
|
|
Karsten Hopp |
cd81af |
! NULL
|
|
Karsten Hopp |
cd81af |
#endif
|
|
Karsten Hopp |
cd81af |
! );
|
|
Karsten Hopp |
cd81af |
! if (called_emsg || got_int)
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! /* Error while handling regexp: stop using this regexp. */
|
|
Karsten Hopp |
cd81af |
! if (shl == &search_hl)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
! /* don't free regprog in the match list, it's a copy */
|
|
Karsten Hopp |
cd81af |
! vim_regfree(shl->rm.regprog);
|
|
Karsten Hopp |
cd81af |
! SET_NO_HLSEARCH(TRUE);
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
! shl->rm.regprog = NULL;
|
|
Karsten Hopp |
cd81af |
! shl->lnum = 0;
|
|
Karsten Hopp |
cd81af |
! got_int = FALSE; /* avoid the "Type :quit to exit Vim" message */
|
|
Karsten Hopp |
cd81af |
! break;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
if (nmatched == 0)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
--- 7431,7465 ----
|
|
Karsten Hopp |
cd81af |
matchcol = shl->rm.endpos[0].col;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
shl->lnum = lnum;
|
|
Karsten Hopp |
cd81af |
! if (shl->rm.regprog != NULL)
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum,
|
|
Karsten Hopp |
cd81af |
! matchcol,
|
|
Karsten Hopp |
cd81af |
#ifdef FEAT_RELTIME
|
|
Karsten Hopp |
cd81af |
! &(shl->tm)
|
|
Karsten Hopp |
cd81af |
#else
|
|
Karsten Hopp |
cd81af |
! NULL
|
|
Karsten Hopp |
cd81af |
#endif
|
|
Karsten Hopp |
cd81af |
! );
|
|
Karsten Hopp |
cd81af |
! if (called_emsg || got_int)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
! /* Error while handling regexp: stop using this regexp. */
|
|
Karsten Hopp |
cd81af |
! if (shl == &search_hl)
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! /* don't free regprog in the match list, it's a copy */
|
|
Karsten Hopp |
cd81af |
! vim_regfree(shl->rm.regprog);
|
|
Karsten Hopp |
cd81af |
! SET_NO_HLSEARCH(TRUE);
|
|
Karsten Hopp |
cd81af |
! }
|
|
Karsten Hopp |
cd81af |
! shl->rm.regprog = NULL;
|
|
Karsten Hopp |
cd81af |
! shl->lnum = 0;
|
|
Karsten Hopp |
cd81af |
! got_int = FALSE; /* avoid the "Type :quit to exit Vim"
|
|
Karsten Hopp |
cd81af |
! message */
|
|
Karsten Hopp |
cd81af |
! break;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
! }
|
|
Karsten Hopp |
cd81af |
! else if (cur != NULL)
|
|
Karsten Hopp |
cd81af |
! {
|
|
Karsten Hopp |
cd81af |
! nmatched = next_search_hl_pos(shl, lnum, &(cur->pos), matchcol);
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
if (nmatched == 0)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 7453,7458 ****
|
|
Karsten Hopp |
cd81af |
--- 7478,7539 ----
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
#endif
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
+ static int
|
|
Karsten Hopp |
cd81af |
+ next_search_hl_pos(shl, lnum, posmatch, mincol)
|
|
Karsten Hopp |
cd81af |
+ match_T *shl; /* points to a match */
|
|
Karsten Hopp |
cd81af |
+ linenr_T lnum;
|
|
Karsten Hopp |
cd81af |
+ posmatch_T *posmatch; /* match positions */
|
|
Karsten Hopp |
cd81af |
+ colnr_T mincol; /* minimal column for a match */
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ int i;
|
|
Karsten Hopp |
cd81af |
+ int bot = -1;
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ shl->lnum = 0;
|
|
Karsten Hopp |
cd81af |
+ for (i = posmatch->cur; i < MAXPOSMATCH; i++)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ if (posmatch->pos[i].lnum == 0)
|
|
Karsten Hopp |
cd81af |
+ break;
|
|
Karsten Hopp |
cd81af |
+ if (posmatch->pos[i].col < mincol)
|
|
Karsten Hopp |
cd81af |
+ continue;
|
|
Karsten Hopp |
cd81af |
+ if (posmatch->pos[i].lnum == lnum)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ if (shl->lnum == lnum)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ /* partially sort positions by column numbers
|
|
Karsten Hopp |
cd81af |
+ * on the same line */
|
|
Karsten Hopp |
cd81af |
+ if (posmatch->pos[i].col < posmatch->pos[bot].col)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ llpos_T tmp = posmatch->pos[i];
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ posmatch->pos[i] = posmatch->pos[bot];
|
|
Karsten Hopp |
cd81af |
+ posmatch->pos[bot] = tmp;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ else
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ bot = i;
|
|
Karsten Hopp |
cd81af |
+ shl->lnum = lnum;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ posmatch->cur = 0;
|
|
Karsten Hopp |
cd81af |
+ if (shl->lnum == lnum)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ colnr_T start = posmatch->pos[bot].col == 0
|
|
Karsten Hopp |
cd81af |
+ ? 0 : posmatch->pos[bot].col - 1;
|
|
Karsten Hopp |
cd81af |
+ colnr_T end = posmatch->pos[bot].col == 0
|
|
Karsten Hopp |
cd81af |
+ ? MAXCOL : start + posmatch->pos[bot].len;
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ shl->rm.startpos[0].lnum = 0;
|
|
Karsten Hopp |
cd81af |
+ shl->rm.startpos[0].col = start;
|
|
Karsten Hopp |
cd81af |
+ shl->rm.endpos[0].lnum = 0;
|
|
Karsten Hopp |
cd81af |
+ shl->rm.endpos[0].col = end;
|
|
Karsten Hopp |
cd81af |
+ posmatch->cur = bot + 1;
|
|
Karsten Hopp |
cd81af |
+ return TRUE;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ return FALSE;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
static void
|
|
Karsten Hopp |
cd81af |
screen_start_highlight(attr)
|
|
Karsten Hopp |
cd81af |
int attr;
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/src/structs.h 2014-05-28 18:22:37.876225054 +0200
|
|
Karsten Hopp |
cd81af |
--- src/structs.h 2014-06-17 17:00:55.524520330 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 1927,1932 ****
|
|
Karsten Hopp |
cd81af |
--- 1927,1958 ----
|
|
Karsten Hopp |
cd81af |
#endif
|
|
Karsten Hopp |
cd81af |
} match_T;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
+ /* number of positions supported by matchaddpos() */
|
|
Karsten Hopp |
cd81af |
+ #define MAXPOSMATCH 8
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ /*
|
|
Karsten Hopp |
cd81af |
+ * Same as lpos_T, but with additional field len.
|
|
Karsten Hopp |
cd81af |
+ */
|
|
Karsten Hopp |
cd81af |
+ typedef struct
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ linenr_T lnum; /* line number */
|
|
Karsten Hopp |
cd81af |
+ colnr_T col; /* column number */
|
|
Karsten Hopp |
cd81af |
+ int len; /* length: 0 - to the end of line */
|
|
Karsten Hopp |
cd81af |
+ } llpos_T;
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ /*
|
|
Karsten Hopp |
cd81af |
+ * posmatch_T provides an array for storing match items for matchaddpos()
|
|
Karsten Hopp |
cd81af |
+ * function.
|
|
Karsten Hopp |
cd81af |
+ */
|
|
Karsten Hopp |
cd81af |
+ typedef struct posmatch posmatch_T;
|
|
Karsten Hopp |
cd81af |
+ struct posmatch
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ llpos_T pos[MAXPOSMATCH]; /* array of positions */
|
|
Karsten Hopp |
cd81af |
+ int cur; /* internal position counter */
|
|
Karsten Hopp |
cd81af |
+ linenr_T toplnum; /* top buffer line */
|
|
Karsten Hopp |
cd81af |
+ linenr_T botlnum; /* bottom buffer line */
|
|
Karsten Hopp |
cd81af |
+ };
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
/*
|
|
Karsten Hopp |
cd81af |
* matchitem_T provides a linked list for storing match items for ":match" and
|
|
Karsten Hopp |
cd81af |
* the match functions.
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 1940,1945 ****
|
|
Karsten Hopp |
cd81af |
--- 1966,1972 ----
|
|
Karsten Hopp |
cd81af |
char_u *pattern; /* pattern to highlight */
|
|
Karsten Hopp |
cd81af |
int hlg_id; /* highlight group ID */
|
|
Karsten Hopp |
cd81af |
regmmatch_T match; /* regexp program for pattern */
|
|
Karsten Hopp |
cd81af |
+ posmatch_T pos; /* position matches */
|
|
Karsten Hopp |
cd81af |
match_T hl; /* struct for doing the actual highlighting */
|
|
Karsten Hopp |
cd81af |
};
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/src/testdir/test63.in 2010-05-15 13:04:10.000000000 +0200
|
|
Karsten Hopp |
cd81af |
--- src/testdir/test63.in 2014-06-17 16:29:36.056449227 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 1,5 ****
|
|
Karsten Hopp |
cd81af |
Test for ":match", ":2match", ":3match", "clearmatches()", "getmatches()",
|
|
Karsten Hopp |
cd81af |
! "matchadd()", "matcharg()", "matchdelete()", and "setmatches()".
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
STARTTEST
|
|
Karsten Hopp |
cd81af |
:so small.vim
|
|
Karsten Hopp |
cd81af |
--- 1,5 ----
|
|
Karsten Hopp |
cd81af |
Test for ":match", ":2match", ":3match", "clearmatches()", "getmatches()",
|
|
Karsten Hopp |
cd81af |
! "matchadd()", "matchaddpos", "matcharg()", "matchdelete()", and "setmatches()".
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
STARTTEST
|
|
Karsten Hopp |
cd81af |
:so small.vim
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 147,155 ****
|
|
Karsten Hopp |
cd81af |
:unlet rf1
|
|
Karsten Hopp |
cd81af |
:unlet rf2
|
|
Karsten Hopp |
cd81af |
:unlet rf3
|
|
Karsten Hopp |
cd81af |
! :highlight clear MyGroup1
|
|
Karsten Hopp |
cd81af |
! :highlight clear MyGroup2
|
|
Karsten Hopp |
cd81af |
! :highlight clear MyGroup3
|
|
Karsten Hopp |
cd81af |
G"rp
|
|
Karsten Hopp |
cd81af |
:/^Results/,$wq! test.out
|
|
Karsten Hopp |
cd81af |
ENDTEST
|
|
Karsten Hopp |
cd81af |
--- 147,172 ----
|
|
Karsten Hopp |
cd81af |
:unlet rf1
|
|
Karsten Hopp |
cd81af |
:unlet rf2
|
|
Karsten Hopp |
cd81af |
:unlet rf3
|
|
Karsten Hopp |
cd81af |
! :" --- Check that "matchaddpos()" positions matches correctly
|
|
Karsten Hopp |
cd81af |
! :let @r .= "*** Test 11:\n"
|
|
Karsten Hopp |
cd81af |
! :set nolazyredraw
|
|
Karsten Hopp |
cd81af |
! :call setline(1, 'abcdefghijklmnopq')
|
|
Karsten Hopp |
cd81af |
! :call matchaddpos("MyGroup1", [[1, 5], [1, 8, 3]], 10, 3)
|
|
Karsten Hopp |
cd81af |
! :1
|
|
Karsten Hopp |
cd81af |
! :redraw!
|
|
Karsten Hopp |
cd81af |
! :let v1 = screenattr(1, 1)
|
|
Karsten Hopp |
cd81af |
! :let v5 = screenattr(1, 5)
|
|
Karsten Hopp |
cd81af |
! :let v6 = screenattr(1, 6)
|
|
Karsten Hopp |
cd81af |
! :let v8 = screenattr(1, 8)
|
|
Karsten Hopp |
cd81af |
! :let v10 = screenattr(1, 10)
|
|
Karsten Hopp |
cd81af |
! :let v11 = screenattr(1, 11)
|
|
Karsten Hopp |
cd81af |
! :let @r .= string(getmatches())."\n"
|
|
Karsten Hopp |
cd81af |
! :if v1 != v5 && v6 == v1 && v8 == v5 && v10 == v5 && v11 == v1
|
|
Karsten Hopp |
cd81af |
! : let @r .= "OK\n"
|
|
Karsten Hopp |
cd81af |
! :else
|
|
Karsten Hopp |
cd81af |
! : let @r .= "FAILED\n"
|
|
Karsten Hopp |
cd81af |
! :endif
|
|
Karsten Hopp |
cd81af |
! :call clearmatches()
|
|
Karsten Hopp |
cd81af |
G"rp
|
|
Karsten Hopp |
cd81af |
:/^Results/,$wq! test.out
|
|
Karsten Hopp |
cd81af |
ENDTEST
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/src/testdir/test63.ok 2010-05-15 13:04:10.000000000 +0200
|
|
Karsten Hopp |
cd81af |
--- src/testdir/test63.ok 2014-06-17 17:32:57.036593023 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 9,11 ****
|
|
Karsten Hopp |
cd81af |
--- 9,14 ----
|
|
Karsten Hopp |
cd81af |
*** Test 8: OK
|
|
Karsten Hopp |
cd81af |
*** Test 9: OK
|
|
Karsten Hopp |
cd81af |
*** Test 10: OK
|
|
Karsten Hopp |
cd81af |
+ *** Test 11:
|
|
Karsten Hopp |
cd81af |
+ [{'group': 'MyGroup1', 'id': 3, 'priority': 10, 'pos1': [1, 5, 1], 'pos2': [1, 8, 3]}]
|
|
Karsten Hopp |
cd81af |
+ OK
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/src/window.c 2014-06-17 13:52:35.868092848 +0200
|
|
Karsten Hopp |
cd81af |
--- src/window.c 2014-06-17 17:04:51.060529240 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 6751,6770 ****
|
|
Karsten Hopp |
cd81af |
* Return ID of added match, -1 on failure.
|
|
Karsten Hopp |
cd81af |
*/
|
|
Karsten Hopp |
cd81af |
int
|
|
Karsten Hopp |
cd81af |
! match_add(wp, grp, pat, prio, id)
|
|
Karsten Hopp |
cd81af |
win_T *wp;
|
|
Karsten Hopp |
cd81af |
char_u *grp;
|
|
Karsten Hopp |
cd81af |
char_u *pat;
|
|
Karsten Hopp |
cd81af |
int prio;
|
|
Karsten Hopp |
cd81af |
int id;
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
! matchitem_T *cur;
|
|
Karsten Hopp |
cd81af |
! matchitem_T *prev;
|
|
Karsten Hopp |
cd81af |
! matchitem_T *m;
|
|
Karsten Hopp |
cd81af |
int hlg_id;
|
|
Karsten Hopp |
cd81af |
! regprog_T *regprog;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
! if (*grp == NUL || *pat == NUL)
|
|
Karsten Hopp |
cd81af |
return -1;
|
|
Karsten Hopp |
cd81af |
if (id < -1 || id == 0)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
--- 6751,6772 ----
|
|
Karsten Hopp |
cd81af |
* Return ID of added match, -1 on failure.
|
|
Karsten Hopp |
cd81af |
*/
|
|
Karsten Hopp |
cd81af |
int
|
|
Karsten Hopp |
cd81af |
! match_add(wp, grp, pat, prio, id, pos_list)
|
|
Karsten Hopp |
cd81af |
win_T *wp;
|
|
Karsten Hopp |
cd81af |
char_u *grp;
|
|
Karsten Hopp |
cd81af |
char_u *pat;
|
|
Karsten Hopp |
cd81af |
int prio;
|
|
Karsten Hopp |
cd81af |
int id;
|
|
Karsten Hopp |
cd81af |
+ list_T *pos_list;
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
! matchitem_T *cur;
|
|
Karsten Hopp |
cd81af |
! matchitem_T *prev;
|
|
Karsten Hopp |
cd81af |
! matchitem_T *m;
|
|
Karsten Hopp |
cd81af |
int hlg_id;
|
|
Karsten Hopp |
cd81af |
! regprog_T *regprog = NULL;
|
|
Karsten Hopp |
cd81af |
! int rtype = SOME_VALID;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
! if (*grp == NUL || (pat != NULL && *pat == NUL))
|
|
Karsten Hopp |
cd81af |
return -1;
|
|
Karsten Hopp |
cd81af |
if (id < -1 || id == 0)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 6789,6795 ****
|
|
Karsten Hopp |
cd81af |
EMSG2(_(e_nogroup), grp);
|
|
Karsten Hopp |
cd81af |
return -1;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
! if ((regprog = vim_regcomp(pat, RE_MAGIC)) == NULL)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
EMSG2(_(e_invarg2), pat);
|
|
Karsten Hopp |
cd81af |
return -1;
|
|
Karsten Hopp |
cd81af |
--- 6791,6797 ----
|
|
Karsten Hopp |
cd81af |
EMSG2(_(e_nogroup), grp);
|
|
Karsten Hopp |
cd81af |
return -1;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
! if (pat != NULL && (regprog = vim_regcomp(pat, RE_MAGIC)) == NULL)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
EMSG2(_(e_invarg2), pat);
|
|
Karsten Hopp |
cd81af |
return -1;
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 6810,6821 ****
|
|
Karsten Hopp |
cd81af |
m = (matchitem_T *)alloc(sizeof(matchitem_T));
|
|
Karsten Hopp |
cd81af |
m->id = id;
|
|
Karsten Hopp |
cd81af |
m->priority = prio;
|
|
Karsten Hopp |
cd81af |
! m->pattern = vim_strsave(pat);
|
|
Karsten Hopp |
cd81af |
m->hlg_id = hlg_id;
|
|
Karsten Hopp |
cd81af |
m->match.regprog = regprog;
|
|
Karsten Hopp |
cd81af |
m->match.rmm_ic = FALSE;
|
|
Karsten Hopp |
cd81af |
m->match.rmm_maxcol = 0;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
/* Insert new match. The match list is in ascending order with regard to
|
|
Karsten Hopp |
cd81af |
* the match priorities. */
|
|
Karsten Hopp |
cd81af |
cur = wp->w_match_head;
|
|
Karsten Hopp |
cd81af |
--- 6812,6922 ----
|
|
Karsten Hopp |
cd81af |
m = (matchitem_T *)alloc(sizeof(matchitem_T));
|
|
Karsten Hopp |
cd81af |
m->id = id;
|
|
Karsten Hopp |
cd81af |
m->priority = prio;
|
|
Karsten Hopp |
cd81af |
! m->pattern = pat == NULL ? NULL : vim_strsave(pat);
|
|
Karsten Hopp |
cd81af |
! m->pos.cur = 0;
|
|
Karsten Hopp |
cd81af |
m->hlg_id = hlg_id;
|
|
Karsten Hopp |
cd81af |
m->match.regprog = regprog;
|
|
Karsten Hopp |
cd81af |
m->match.rmm_ic = FALSE;
|
|
Karsten Hopp |
cd81af |
m->match.rmm_maxcol = 0;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
+ /* Set up position matches */
|
|
Karsten Hopp |
cd81af |
+ if (pos_list != NULL)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ linenr_T toplnum = 0;
|
|
Karsten Hopp |
cd81af |
+ linenr_T botlnum = 0;
|
|
Karsten Hopp |
cd81af |
+ listitem_T *li;
|
|
Karsten Hopp |
cd81af |
+ int i;
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ for (i = 0, li = pos_list->lv_first; i < MAXPOSMATCH;
|
|
Karsten Hopp |
cd81af |
+ i++, li = li->li_next)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ linenr_T lnum = 0;
|
|
Karsten Hopp |
cd81af |
+ colnr_T col = 0;
|
|
Karsten Hopp |
cd81af |
+ int len = 1;
|
|
Karsten Hopp |
cd81af |
+ list_T *subl;
|
|
Karsten Hopp |
cd81af |
+ listitem_T *subli;
|
|
Karsten Hopp |
cd81af |
+ int error;
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ if (li == NULL)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ m->pos.pos[i].lnum = 0;
|
|
Karsten Hopp |
cd81af |
+ break;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ if (li->li_tv.v_type == VAR_LIST)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ subl = li->li_tv.vval.v_list;
|
|
Karsten Hopp |
cd81af |
+ if (subl == NULL)
|
|
Karsten Hopp |
cd81af |
+ goto fail;
|
|
Karsten Hopp |
cd81af |
+ subli = subl->lv_first;
|
|
Karsten Hopp |
cd81af |
+ if (subli == NULL)
|
|
Karsten Hopp |
cd81af |
+ goto fail;
|
|
Karsten Hopp |
cd81af |
+ lnum = get_tv_number_chk(&subli->li_tv, &error);
|
|
Karsten Hopp |
cd81af |
+ if (error == TRUE)
|
|
Karsten Hopp |
cd81af |
+ goto fail;
|
|
Karsten Hopp |
cd81af |
+ m->pos.pos[i].lnum = lnum;
|
|
Karsten Hopp |
cd81af |
+ if (lnum == 0)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ --i;
|
|
Karsten Hopp |
cd81af |
+ continue;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ subli = subli->li_next;
|
|
Karsten Hopp |
cd81af |
+ if (subli != NULL)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ col = get_tv_number_chk(&subli->li_tv, &error);
|
|
Karsten Hopp |
cd81af |
+ if (error == TRUE)
|
|
Karsten Hopp |
cd81af |
+ goto fail;
|
|
Karsten Hopp |
cd81af |
+ subli = subli->li_next;
|
|
Karsten Hopp |
cd81af |
+ if (subli != NULL)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ len = get_tv_number_chk(&subli->li_tv, &error);
|
|
Karsten Hopp |
cd81af |
+ if (error == TRUE)
|
|
Karsten Hopp |
cd81af |
+ goto fail;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ m->pos.pos[i].col = col;
|
|
Karsten Hopp |
cd81af |
+ m->pos.pos[i].len = len;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ else if (li->li_tv.v_type == VAR_NUMBER)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ if (li->li_tv.vval.v_number == 0)
|
|
Karsten Hopp |
cd81af |
+ continue;
|
|
Karsten Hopp |
cd81af |
+ m->pos.pos[i].lnum = li->li_tv.vval.v_number;
|
|
Karsten Hopp |
cd81af |
+ m->pos.pos[i].col = 0;
|
|
Karsten Hopp |
cd81af |
+ m->pos.pos[i].len = 0;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ else
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ EMSG(_("List or number required"));
|
|
Karsten Hopp |
cd81af |
+ goto fail;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ if (toplnum == 0 || lnum < toplnum)
|
|
Karsten Hopp |
cd81af |
+ toplnum = lnum;
|
|
Karsten Hopp |
cd81af |
+ if (botlnum == 0 || lnum > botlnum)
|
|
Karsten Hopp |
cd81af |
+ botlnum = lnum;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ /* Calculate top and bottom lines for redrawing area */
|
|
Karsten Hopp |
cd81af |
+ if (toplnum != 0)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ if (wp->w_buffer->b_mod_set)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ if (wp->w_buffer->b_mod_top > toplnum)
|
|
Karsten Hopp |
cd81af |
+ wp->w_buffer->b_mod_top = toplnum;
|
|
Karsten Hopp |
cd81af |
+ if (wp->w_buffer->b_mod_bot < botlnum)
|
|
Karsten Hopp |
cd81af |
+ wp->w_buffer->b_mod_bot = botlnum;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ else
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ wp->w_buffer->b_mod_top = toplnum;
|
|
Karsten Hopp |
cd81af |
+ wp->w_buffer->b_mod_bot = botlnum;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ m->pos.toplnum = toplnum;
|
|
Karsten Hopp |
cd81af |
+ m->pos.botlnum = botlnum;
|
|
Karsten Hopp |
cd81af |
+ wp->w_buffer->b_mod_set = TRUE;
|
|
Karsten Hopp |
cd81af |
+ rtype = VALID;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
/* Insert new match. The match list is in ascending order with regard to
|
|
Karsten Hopp |
cd81af |
* the match priorities. */
|
|
Karsten Hopp |
cd81af |
cur = wp->w_match_head;
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 6831,6838 ****
|
|
Karsten Hopp |
cd81af |
prev->next = m;
|
|
Karsten Hopp |
cd81af |
m->next = cur;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
! redraw_later(SOME_VALID);
|
|
Karsten Hopp |
cd81af |
return id;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
/*
|
|
Karsten Hopp |
cd81af |
--- 6932,6943 ----
|
|
Karsten Hopp |
cd81af |
prev->next = m;
|
|
Karsten Hopp |
cd81af |
m->next = cur;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
! redraw_later(rtype);
|
|
Karsten Hopp |
cd81af |
return id;
|
|
Karsten Hopp |
cd81af |
+
|
|
Karsten Hopp |
cd81af |
+ fail:
|
|
Karsten Hopp |
cd81af |
+ vim_free(m);
|
|
Karsten Hopp |
cd81af |
+ return -1;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
/*
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 6845,6852 ****
|
|
Karsten Hopp |
cd81af |
int id;
|
|
Karsten Hopp |
cd81af |
int perr;
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
! matchitem_T *cur = wp->w_match_head;
|
|
Karsten Hopp |
cd81af |
! matchitem_T *prev = cur;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
if (id < 1)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
--- 6950,6958 ----
|
|
Karsten Hopp |
cd81af |
int id;
|
|
Karsten Hopp |
cd81af |
int perr;
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
! matchitem_T *cur = wp->w_match_head;
|
|
Karsten Hopp |
cd81af |
! matchitem_T *prev = cur;
|
|
Karsten Hopp |
cd81af |
! int rtype = SOME_VALID;
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
if (id < 1)
|
|
Karsten Hopp |
cd81af |
{
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 6872,6879 ****
|
|
Karsten Hopp |
cd81af |
prev->next = cur->next;
|
|
Karsten Hopp |
cd81af |
vim_regfree(cur->match.regprog);
|
|
Karsten Hopp |
cd81af |
vim_free(cur->pattern);
|
|
Karsten Hopp |
cd81af |
vim_free(cur);
|
|
Karsten Hopp |
cd81af |
! redraw_later(SOME_VALID);
|
|
Karsten Hopp |
cd81af |
return 0;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
--- 6978,7002 ----
|
|
Karsten Hopp |
cd81af |
prev->next = cur->next;
|
|
Karsten Hopp |
cd81af |
vim_regfree(cur->match.regprog);
|
|
Karsten Hopp |
cd81af |
vim_free(cur->pattern);
|
|
Karsten Hopp |
cd81af |
+ if (cur->pos.toplnum != 0)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ if (wp->w_buffer->b_mod_set)
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ if (wp->w_buffer->b_mod_top > cur->pos.toplnum)
|
|
Karsten Hopp |
cd81af |
+ wp->w_buffer->b_mod_top = cur->pos.toplnum;
|
|
Karsten Hopp |
cd81af |
+ if (wp->w_buffer->b_mod_bot < cur->pos.botlnum)
|
|
Karsten Hopp |
cd81af |
+ wp->w_buffer->b_mod_bot = cur->pos.botlnum;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ else
|
|
Karsten Hopp |
cd81af |
+ {
|
|
Karsten Hopp |
cd81af |
+ wp->w_buffer->b_mod_top = cur->pos.toplnum;
|
|
Karsten Hopp |
cd81af |
+ wp->w_buffer->b_mod_bot = cur->pos.botlnum;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
+ wp->w_buffer->b_mod_set = TRUE;
|
|
Karsten Hopp |
cd81af |
+ rtype = VALID;
|
|
Karsten Hopp |
cd81af |
+ }
|
|
Karsten Hopp |
cd81af |
vim_free(cur);
|
|
Karsten Hopp |
cd81af |
! redraw_later(rtype);
|
|
Karsten Hopp |
cd81af |
return 0;
|
|
Karsten Hopp |
cd81af |
}
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
*** ../vim-7.4.329/src/version.c 2014-06-17 13:52:35.868092848 +0200
|
|
Karsten Hopp |
cd81af |
--- src/version.c 2014-06-17 14:11:53.764136653 +0200
|
|
Karsten Hopp |
cd81af |
***************
|
|
Karsten Hopp |
cd81af |
*** 736,737 ****
|
|
Karsten Hopp |
cd81af |
--- 736,739 ----
|
|
Karsten Hopp |
cd81af |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
cd81af |
+ /**/
|
|
Karsten Hopp |
cd81af |
+ 330,
|
|
Karsten Hopp |
cd81af |
/**/
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
--
|
|
Karsten Hopp |
cd81af |
I'd like to meet the man who invented sex and see what he's working on now.
|
|
Karsten Hopp |
cd81af |
|
|
Karsten Hopp |
cd81af |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
cd81af |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
cd81af |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
cd81af |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|