diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-01-23 15:53:15 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-01-23 15:53:15 +0100 |
commit | 9d182dd0a666f7cb706cd54dd78df3f59a160fff (patch) | |
tree | 53eb72dd576979b4fdde34e2b0eaff7f972a028f /src/mark.c | |
parent | 4da70dbc4ddef9b2a2815cc0f6f09a283b65e671 (diff) | |
download | vim-git-9d182dd0a666f7cb706cd54dd78df3f59a160fff.tar.gz |
updated for version 7.3.776v7.3.776
Problem: ml_get error when searching, caused by curwin not matching curbuf.
Solution: Avoid changing curbuf. (Lech Lorens)
Diffstat (limited to 'src/mark.c')
-rw-r--r-- | src/mark.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/mark.c b/src/mark.c index 9b304f3d3..540f70b97 100644 --- a/src/mark.c +++ b/src/mark.c @@ -304,7 +304,7 @@ movechangelist(count) #endif /* - * Find mark "c". + * Find mark "c" in buffer pointed to by "buf". * If "changefile" is TRUE it's allowed to edit another file for '0, 'A, etc. * If "fnum" is not NULL store the fnum there for '0, 'A etc., don't edit * another file. @@ -315,15 +315,25 @@ movechangelist(count) * - -1 if mark is in other file and jumped there (only if changefile is TRUE) */ pos_T * +getmark_buf(buf, c, changefile) + buf_T *buf; + int c; + int changefile; +{ + return getmark_buf_fnum(buf, c, changefile, NULL); +} + + pos_T * getmark(c, changefile) int c; int changefile; { - return getmark_fnum(c, changefile, NULL); + return getmark_buf_fnum(curbuf, c, changefile, NULL); } pos_T * -getmark_fnum(c, changefile, fnum) +getmark_buf_fnum(buf, c, changefile, fnum) + buf_T *buf; int c; int changefile; int *fnum; @@ -351,15 +361,15 @@ getmark_fnum(c, changefile, fnum) posp = &pos_copy; /* w_pcmark may be changed soon */ } else if (c == '"') /* to pos when leaving buffer */ - posp = &(curbuf->b_last_cursor); + posp = &(buf->b_last_cursor); else if (c == '^') /* to where Insert mode stopped */ - posp = &(curbuf->b_last_insert); + posp = &(buf->b_last_insert); else if (c == '.') /* to where last change was made */ - posp = &(curbuf->b_last_change); + posp = &(buf->b_last_change); else if (c == '[') /* to start of previous operator */ - posp = &(curbuf->b_op_start); + posp = &(buf->b_op_start); else if (c == ']') /* to end of previous operator */ - posp = &(curbuf->b_op_end); + posp = &(buf->b_op_end); else if (c == '{' || c == '}') /* to previous/next paragraph */ { pos_T pos; @@ -395,8 +405,8 @@ getmark_fnum(c, changefile, fnum) #ifdef FEAT_VISUAL else if (c == '<' || c == '>') /* start/end of visual area */ { - startp = &curbuf->b_visual.vi_start; - endp = &curbuf->b_visual.vi_end; + startp = &buf->b_visual.vi_start; + endp = &buf->b_visual.vi_end; if ((c == '<') == lt(*startp, *endp)) posp = startp; else @@ -404,7 +414,7 @@ getmark_fnum(c, changefile, fnum) /* * For Visual line mode, set mark at begin or end of line */ - if (curbuf->b_visual.vi_mode == 'V') + if (buf->b_visual.vi_mode == 'V') { pos_copy = *posp; posp = &pos_copy; @@ -420,7 +430,7 @@ getmark_fnum(c, changefile, fnum) #endif else if (ASCII_ISLOWER(c)) /* normal named mark */ { - posp = &(curbuf->b_namedm[c - 'a']); + posp = &(buf->b_namedm[c - 'a']); } else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) /* named file mark */ { @@ -435,7 +445,7 @@ getmark_fnum(c, changefile, fnum) if (fnum != NULL) *fnum = namedfm[c].fmark.fnum; - else if (namedfm[c].fmark.fnum != curbuf->b_fnum) + else if (namedfm[c].fmark.fnum != buf->b_fnum) { /* mark is in another file */ posp = &pos_copy; |