summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-01-27 14:41:15 +0000
committerBram Moolenaar <Bram@vim.org>2005-01-27 14:41:15 +0000
commit677ee6890d12218461196f5df92b4dc3d0e52129 (patch)
treec59a8f9d1b14e8c3abc4929c2b5f7a2b71698bdb
parent10de2da0f567ae615913fe6bc9831590436af4e5 (diff)
updated for version 7.0045
-rw-r--r--Filelist2
-rw-r--r--runtime/doc/autocmd.txt4
-rw-r--r--runtime/doc/eval.txt59
-rw-r--r--runtime/doc/insert.txt5
-rw-r--r--runtime/doc/options.txt6
-rw-r--r--runtime/doc/pattern.txt4
-rw-r--r--runtime/doc/pi_netrw.txt2
-rw-r--r--runtime/doc/syntax.txt4
-rw-r--r--runtime/doc/tags34
-rw-r--r--runtime/doc/various.txt8
-rw-r--r--runtime/doc/version6.txt4
-rw-r--r--runtime/doc/windows.txt4
-rw-r--r--runtime/syntax/c.vim10
-rw-r--r--src/edit.c5
-rw-r--r--src/hashtable.c3
-rw-r--r--src/mbyte.c2
-rw-r--r--src/ops.c11
-rw-r--r--src/search.c85
-rw-r--r--src/structs.h4
-rw-r--r--src/version.h4
20 files changed, 145 insertions, 115 deletions
diff --git a/Filelist b/Filelist
index ed315fc61d..bdd33c1624 100644
--- a/Filelist
+++ b/Filelist
@@ -74,7 +74,7 @@ SRC_ALL2 = \
src/main.aap \
src/testdir/main.aap \
src/testdir/*.in \
- src/testdir/*.ok \
+ src/testdir/test[0-9]*.ok \
src/testdir/test49.vim \
src/proto.h \
src/proto/buffer.pro \
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 9c69d2cd34..2b7edf5eca 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt* For Vim version 7.0aa. Last change: 2004 Dec 24
+*autocmd.txt* For Vim version 7.0aa. Last change: 2005 Jan 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -495,7 +495,7 @@ InsertChange When typing <Insert> while in Insert or
anything else that the user does not expect.
*InsertLeave*
InsertLeave When leaving Insert mode. Also when using
- CTRL-O |i_CTRL-O|.
+ CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
*FileEncoding*
FileEncoding Obsolete. It still works and is equivalent
to |EncodingChanged|.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 5cb961132d..cbd233a398 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.0aa. Last change: 2005 Jan 25
+*eval.txt* For Vim version 7.0aa. Last change: 2005 Jan 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1458,6 +1458,7 @@ inputsave() Number save and clear typeahead
inputsecret( {prompt} [, {text}]) String like input() but hiding the text
insert( {list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}]
isdirectory( {directory}) Number TRUE if {directory} is a directory
+items( {dict}) List List of key-value pairs in {dict}
join( {list} [, {sep}]) String join {list} items into one String
keys( {dict}) List List of keys in {dict}
len( {expr}) Number the length of {expr}
@@ -1519,7 +1520,8 @@ string( {expr}) String String representation of {expr} value
strlen( {expr}) Number length of the String {expr}
strpart( {src}, {start}[, {len}])
String {len} characters of {src} at {start}
-strridx( {haystack}, {needle}) Number last index of {needle} in {haystack}
+strridx( {haystack}, {needle} [, {start}])
+ Number last index of {needle} in {haystack}
strtrans( {expr}) String translate string to make it printable
submatch( {nr}) String specific match in ":substitute"
substitute( {expr}, {pat}, {sub}, {flags})
@@ -1535,6 +1537,7 @@ toupper( {expr}) String the String {expr} switched to uppercase
tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
to chars in {tostr}
type( {name}) Number type of variable {name}
+values( {dict}) List List of values in {dict}
virtcol( {expr}) Number screen column of cursor or mark
visualmode( [expr]) String last visual mode used
winbufnr( {nr}) Number buffer number of window {nr}
@@ -2266,7 +2269,7 @@ function({name}) *function()* *E700*
{name} can be a user defined function or an internal function.
-get({list}, {idx} [, {default}]) *get*
+get({list}, {idx} [, {default}]) *get()*
Get item {idx} from List {list}. When this item is not
available return {default}. Return zero when {default} is
omitted.
@@ -2780,6 +2783,11 @@ isdirectory({directory}) *isdirectory()*
exist, or isn't a directory, the result is FALSE. {directory}
is any expression, which is used as a String.
+items({dict}) *items()*
+ Return a List with all the key-value pairs of {dict}. Each
+ List item is a list with two items: the key of a {dict} entry
+ and the value of this entry. The List is in arbitrary order.
+
join({list} [, {sep}]) *join()*
Join the items in {list} together into one String.
@@ -3517,12 +3525,15 @@ strftime({format} [, {time}]) *strftime()*
stridx({haystack}, {needle} [, {start}]) *stridx()*
The result is a Number, which gives the byte index in
{haystack} of the first occurrence of the String {needle}.
- If {start} is specified, the String {needle} is searched from
- the byte index {start} in the String {haystack}.
- The search is done case-sensitive.
+ If {start} is specified, the search starts at index {start}.
+ This can be used to find a second match: >
+ :let comma1 = stridx(line, ",")
+ :let comma2 = stridx(line, ",", comma1 + 1)
+< The search is done case-sensitive.
For pattern searches use |match()|.
-1 is returned if the {needle} does not occur in {haystack}.
- See also |strridx()|. Examples: >
+ See also |strridx()|.
+ Examples: >
:echo stridx("An Example", "Example") 3
:echo stridx("Starting point", "Start") 0
:echo stridx("Starting point", "start") -1
@@ -3565,10 +3576,15 @@ strpart({src}, {start}[, {len}]) *strpart()*
example, to get three bytes under and after the cursor: >
strpart(getline(line(".")), col(".") - 1, 3)
<
-strridx({haystack}, {needle}) *strridx()*
- The result is a Number, which gives the index in {haystack} of
- the last occurrence of the String {needle}.
- The search is done case-sensitive.
+strridx({haystack}, {needle} [, {start}]) *strridx()*
+ The result is a Number, which gives the byte index in
+ {haystack} of the last occurrence of the String {needle}.
+ When {start} is specified, matches beyond this index are
+ ignored. This can be used to find a match before a previous
+ match: >
+ :let lastcomma = strridx(line, ",")
+ :let comma2 = strridx(line, ",", lastcomma - 1)
+< The search is done case-sensitive.
For pattern searches use |match()|.
-1 is returned if the {needle} does not occur in {haystack}.
If the {needle} is empty the length of {haystack} is returned.
@@ -3742,6 +3758,11 @@ type({expr}) The result is a Number, depending on the type of {expr}:
:if type(myvar) == type(function("tr"))
:if type(myvar) == type([])
+values({dict}) *values()*
+ Return a List with all the values of {dict}. The List is in
+ arbitrary order.
+
+
virtcol({expr}) *virtcol()*
The result is a Number, which is the screen column of the file
position given with {expr}. That is, the last screen position
@@ -4161,17 +4182,15 @@ Example: >
: echohl Title
: echo a:title
: echohl None
- : let idx = 1
- : while idx <= a:0
- : echo a:{idx} . ' '
- : let idx = idx + 1
- : endwhile
- : return idx
+ : echo a:0 . " items:"
+ : for s in a:000
+ : echon ' ' . s
+ : endfor
:endfunction
This function can then be called with: >
- let lines = Table("Table", "line1", "line2")
- let lines = Table("Empty Table")
+ call Table("Table", "line1", "line2")
+ call Table("Empty Table")
To return more than one value, pass the name of a global variable: >
:function Compute(n1, n2, divname)
@@ -4411,7 +4430,7 @@ This would call the function "my_func_whizz(parameter)".
List item.
:let [{name}, ..., ; {lastname}] = {expr1}
- Like |let-unpack| above, but the List may have more
+ Like |:let-unpack| above, but the List may have more
items than there are names. A list of the remaining
items is assigned to {lastname}. If there are no
remaining items {lastname} is set to an empty list.
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index 579068c586..74b68e16a2 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1,4 +1,4 @@
-*insert.txt* For Vim version 7.0aa. Last change: 2005 Jan 05
+*insert.txt* For Vim version 7.0aa. Last change: 2005 Jan 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -53,7 +53,8 @@ char action ~
yourself to use CTRL-[.
*i_CTRL-C*
CTRL-C Quit insert mode, go back to Normal mode. Do not check for
- abbreviations.
+ abbreviations. Does not trigger the |InsertLeave| autocommand
+ event.
*i_CTRL-@*
CTRL-@ Insert previously inserted text and stop insert. {Vi: only
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 62b6de999f..0adbb8d3b8 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 7.0aa. Last change: 2005 Jan 14
+*options.txt* For Vim version 7.0aa. Last change: 2005 Jan 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2738,7 +2738,7 @@ A jump table for the options with a short description can be found at |Q_op|.
A pattern that is used to recognize a list header. This is used for
the "n" flag in 'formatoptions'.
The pattern must match exactly the text that will be the indent for
- the line below it. You can use |\ze| to mark the end of the match
+ the line below it. You can use |/\ze| to mark the end of the match
while still checking more characters. There must be a character
following the pattern, when it matches the whole line it is handled
like there is no match.
@@ -4656,7 +4656,7 @@ A jump table for the options with a short description can be found at |Q_op|.
List of items that control the format of the output of |:hardcopy|.
See |popt-option|.
- *'quoteescape''* *'qe'*
+ *'quoteescape'* *'qe'*
'quoteescape' 'qe' string (default "\")
local to buffer
{not in Vi}
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 21c9f57c09..2ff676ac2d 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -1,4 +1,4 @@
-*pattern.txt* For Vim version 7.0aa. Last change: 2005 Jan 24
+*pattern.txt* For Vim version 7.0aa. Last change: 2005 Jan 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1027,7 +1027,7 @@ x A single character, with no special meaning, matches itself
< Matches the words "r", "re", "ro", "rea", "roa", "read" and "road".
{not available when compiled without the +syntax feature}
- */\%d* */\%x* */\%o* */\%u* */\%U/* *E678*
+ */\%d* */\%x* */\%o* */\%u* */\%U* *E678*
\%d123 Matches the character specified with a decimal number. Must be
followed by a non-digit.
diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt
index 4e8243dcdf..3f202da1b8 100644
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/doc/pi_netrw.txt
@@ -740,7 +740,7 @@ One may rename a block of files and directories by selecting them with
the V (|linewise-visual|).
-HIDING FILES OR DIRECTORIES *g:netrw-a* *g:netrw_list_hide*
+HIDING FILES OR DIRECTORIES *netrw-a* *g:netrw_list_hide*
Netrw's browsing facility allows one to use the hiding list in one of
three ways: ignore it, hide files which match, and show only those files
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 583a784e4a..c421a22982 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1,4 +1,4 @@
-*syntax.txt* For Vim version 7.0aa. Last change: 2004 Dec 09
+*syntax.txt* For Vim version 7.0aa. Last change: 2005 Jan 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -631,6 +631,8 @@ c_space_errors trailing white space and spaces before a <Tab>
c_no_trail_space_error ... but no trailing spaces
c_no_tab_space_error ... but no spaces before a <Tab>
c_no_bracket_error don't highlight {}; inside [] as errors
+c_no_curly_error don't highlight {}; inside [] and () as errors;
+ except { and } in first column
c_no_ansi don't do standard ANSI types and constants
c_ansi_typedefs ... but do standard ANSI types
c_ansi_constants ... but do standard ANSI constants
diff --git a/runtime/doc/tags b/runtime/doc/tags
index ab5781e74d..e86052cbf1 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -639,7 +639,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
'pvw' options.txt /*'pvw'*
'qe' options.txt /*'qe'*
'quote motion.txt /*'quote*
-'quoteescape'' options.txt /*'quoteescape''*
+'quoteescape' options.txt /*'quoteescape'*
'readonly' options.txt /*'readonly'*
'redraw' vi_diff.txt /*'redraw'*
'remap' options.txt /*'remap'*
@@ -1226,7 +1226,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
/\%>c pattern.txt /*\/\\%>c*
/\%>l pattern.txt /*\/\\%>l*
/\%>v pattern.txt /*\/\\%>v*
-/\%U/ pattern.txt /*\/\\%U\/*
+/\%U pattern.txt /*\/\\%U*
/\%[] pattern.txt /*\/\\%[]*
/\%^ pattern.txt /*\/\\%^*
/\%c pattern.txt /*\/\\%c*
@@ -1581,6 +1581,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:, cmdline.txt /*:,*
:. cmdline.txt /*:.*
:/ cmdline.txt /*:\/*
+:0file editing.txt /*:0file*
::. cmdline.txt /*::.*
::8 cmdline.txt /*::8*
::e cmdline.txt /*::e*
@@ -1606,13 +1607,11 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:@ repeat.txt /*:@*
:@: repeat.txt /*:@:*
:@@ repeat.txt /*:@@*
-:Explore pi_expl.txt /*:Explore*
:Man filetype.txt /*:Man*
:N editing.txt /*:N*
:Next editing.txt /*:Next*
:P various.txt /*:P*
:Print various.txt /*:Print*
-:Sexplore pi_expl.txt /*:Sexplore*
:TOhtml syntax.txt /*:TOhtml*
:X editing.txt /*:X*
:\bar cmdline.txt /*:\\bar*
@@ -4655,9 +4654,6 @@ exists() eval.txt /*exists()*
expand() eval.txt /*expand()*
expand-env options.txt /*expand-env*
expand-environment-var options.txt /*expand-environment-var*
-expl-starting pi_expl.txt /*expl-starting*
-explorer-delete pi_expl.txt /*explorer-delete*
-explorer-rename pi_expl.txt /*explorer-rename*
expr eval.txt /*expr*
expr-! eval.txt /*expr-!*
expr-!= eval.txt /*expr-!=*
@@ -4732,9 +4728,7 @@ farsi.txt farsi.txt /*farsi.txt*
fasm.vim syntax.txt /*fasm.vim*
feature-list eval.txt /*feature-list*
fetch pi_netrw.txt /*fetch*
-file-browser pi_expl.txt /*file-browser*
file-browser-5.2 version5.txt /*file-browser-5.2*
-file-explorer pi_expl.txt /*file-explorer*
file-formats editing.txt /*file-formats*
file-pattern autocmd.txt /*file-pattern*
file-read insert.txt /*file-read*
@@ -4850,22 +4844,6 @@ g'a motion.txt /*g'a*
g, motion.txt /*g,*
g0 motion.txt /*g0*
g8 various.txt /*g8*
-g:explDateFormat pi_expl.txt /*g:explDateFormat*
-g:explDetailedHelp pi_expl.txt /*g:explDetailedHelp*
-g:explDetailedList pi_expl.txt /*g:explDetailedList*
-g:explDirsFirst pi_expl.txt /*g:explDirsFirst*
-g:explFileHandler pi_expl.txt /*g:explFileHandler*
-g:explHideFiles pi_expl.txt /*g:explHideFiles*
-g:explSortBy pi_expl.txt /*g:explSortBy*
-g:explSplitBelow pi_expl.txt /*g:explSplitBelow*
-g:explSplitRight pi_expl.txt /*g:explSplitRight*
-g:explStartBelow pi_expl.txt /*g:explStartBelow*
-g:explStartRight pi_expl.txt /*g:explStartRight*
-g:explSuffixesLast pi_expl.txt /*g:explSuffixesLast*
-g:explUseSeparators pi_expl.txt /*g:explUseSeparators*
-g:explVertical pi_expl.txt /*g:explVertical*
-g:explWinSize pi_expl.txt /*g:explWinSize*
-g:netrw-a pi_netrw.txt /*g:netrw-a*
g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd*
g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide*
g:netrw_rm_cmd pi_netrw.txt /*g:netrw_rm_cmd*
@@ -4906,7 +4884,7 @@ g`a motion.txt /*g`a*
ga various.txt /*ga*
gd pattern.txt /*gd*
ge motion.txt /*ge*
-get eval.txt /*get*
+get() eval.txt /*get()*
getbufvar() eval.txt /*getbufvar()*
getchar() eval.txt /*getchar()*
getcharmod() eval.txt /*getcharmod()*
@@ -5314,6 +5292,7 @@ ip motion.txt /*ip*
iquote motion.txt /*iquote*
is motion.txt /*is*
isdirectory() eval.txt /*isdirectory()*
+items() eval.txt /*items()*
iw motion.txt /*iw*
i{ motion.txt /*i{*
i} motion.txt /*i}*
@@ -5593,6 +5572,7 @@ netrw-D pi_netrw.txt /*netrw-D*
netrw-R pi_netrw.txt /*netrw-R*
netrw-S pi_netrw.txt /*netrw-S*
netrw-U pi_netrw.txt /*netrw-U*
+netrw-a pi_netrw.txt /*netrw-a*
netrw-activate pi_netrw.txt /*netrw-activate*
netrw-b pi_netrw.txt /*netrw-b*
netrw-bookmark pi_netrw.txt /*netrw-bookmark*
@@ -5823,7 +5803,6 @@ php3-syntax syntax.txt /*php3-syntax*
php3.vim syntax.txt /*php3.vim*
phtml-syntax syntax.txt /*phtml-syntax*
phtml.vim syntax.txt /*phtml.vim*
-pi_expl.txt pi_expl.txt /*pi_expl.txt*
pi_gzip.txt pi_gzip.txt /*pi_gzip.txt*
pi_netrw.txt pi_netrw.txt /*pi_netrw.txt*
pi_spec.txt pi_spec.txt /*pi_spec.txt*
@@ -6693,6 +6672,7 @@ v_x change.txt /*v_x*
v_y change.txt /*v_y*
v_~ change.txt /*v_~*
val-variable eval.txt /*val-variable*
+values() eval.txt /*values()*
variables eval.txt /*variables*
various various.txt /*various*
various-cmds various.txt /*various-cmds*
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index a04dd30cb5..eb5cc8b82c 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -1,4 +1,4 @@
-*various.txt* For Vim version 7.0aa. Last change: 2005 Jan 20
+*various.txt* For Vim version 7.0aa. Last change: 2005 Jan 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -492,9 +492,9 @@ K Run a program to lookup the keyword under the
:sleep 100m "sleep for a hundred milliseconds
10gs "sleep for ten seconds
< Can be interrupted with CTRL-C (CTRL-Break on MS-DOS).
- "gs" stands for "goto sleep". While sleeping the
- cursor is positioned in the text (if visible). {not
- in Vi}
+ "gs" stands for "goto sleep".
+ While sleeping the cursor is positioned in the text,
+ if at a visible position. {not in Vi}
*g_CTRL-A*
g CTRL-A Only when Vim was compiled with MEM_PROFILING defined
diff --git a/runtime/doc/version6.txt b/runtime/doc/version6.txt
index bb04a6b4be..1712754a7a 100644
--- a/runtime/doc/version6.txt
+++ b/runtime/doc/version6.txt
@@ -1,4 +1,4 @@
-*version6.txt* For Vim version 7.0aa. Last change: 2004 Jun 16
+*version6.txt* For Vim version 7.0aa. Last change: 2005 Jan 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -865,8 +865,6 @@ on a directory moves the browser to that directory.
There are several other possibilities, such as opening a file in the preview
window, renaming files and deleting files.
-See |file-explorer|.
-
Editing files over a network *new-network-files*
----------------------------
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index 4ba6d4a268..f9616a72b9 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -1,4 +1,4 @@
-*windows.txt* For Vim version 7.0aa. Last change: 2004 Dec 29
+*windows.txt* For Vim version 7.0aa. Last change: 2005 Jan 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1098,7 +1098,7 @@ help Contains a help file. Will only be created with the |:help|
and can't be changed. The 'buflisted' option will be reset
for a help buffer.
-directory Displays directory contents. Used by the |file-explorer|
+directory Displays directory contents. Can be used by a file explorer
plugin. The buffer is created with these settings: >
:set buftype=nowrite
:set bufhidden=delete
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim
index ee739b9e09..eef33822b7 100644
--- a/runtime/syntax/c.vim
+++ b/runtime/syntax/c.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2004 Dec 09
+" Last Change: 2005 Jan 26
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
@@ -67,7 +67,13 @@ endif
" also accept <% for {, %> for }, <: for [ and :> for ] (C99)
" But avoid matching <::.
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cCommentSkip,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
-if exists("c_no_bracket_error")
+if exists("c_no_curly_error")
+ syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
+ " cCppParen: same as cParen but ends at end-of-line; used in cDefine
+ syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
+ syn match cParenError display ")"
+ syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
+elseif exists("c_no_bracket_error")
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
diff --git a/src/edit.c b/src/edit.c
index cb2d82a8c1..175256e64c 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -6121,8 +6121,11 @@ ins_reg()
im_set_active(TRUE);
# endif
}
- if (regname == NUL)
+ if (regname == NUL || !valid_yank_reg(regname, FALSE))
+ {
+ vim_beep();
need_redraw = TRUE; /* remove the '"' */
+ }
else
{
#endif
diff --git a/src/hashtable.c b/src/hashtable.c
index 1dea067905..e6651e38ee 100644
--- a/src/hashtable.c
+++ b/src/hashtable.c
@@ -336,7 +336,8 @@ hash_may_resize(ht)
else
{
/* Allocate an array. */
- newarray = (hashitem_T *)alloc((unsigned)(sizeof(hashitem_T) * newsize));
+ newarray = (hashitem_T *)alloc((unsigned)
+ (sizeof(hashitem_T) * newsize));
if (newarray == NULL)
{
/* Out of memory. When there are NULL items still return OK.
diff --git a/src/mbyte.c b/src/mbyte.c
index f53a8ecc6d..f3092556df 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -2407,6 +2407,7 @@ utf_head_off(base, p)
return (int)(p - q);
}
+#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Copy a character from "*fp" to "*tp" and advance the pointers.
*/
@@ -2421,6 +2422,7 @@ mb_copy_char(fp, tp)
*tp += l;
*fp += l;
}
+#endif
/*
* Return the offset from "p" to the first byte of a character. When "p" is
diff --git a/src/ops.c b/src/ops.c
index ddc0aab3de..4a052925db 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -813,6 +813,7 @@ valid_yank_reg(regname, writing)
/*
* Set y_current and y_append, according to the value of "regname".
* Cannot handle the '_' register.
+ * Must only be called with a valid register name!
*
* If regname is 0 and writing, use register 0
* If regname is 0 and reading, use previous register
@@ -2996,10 +2997,11 @@ copy_yank_reg(reg)
#endif
/*
- * put contents of register "regname" into the text
- * flags: PUT_FIXINDENT make indent look nice
- * PUT_CURSEND leave cursor after end of new text
- * PUT_LINE force linewise put (":put")
+ * Put contents of register "regname" into the text.
+ * Caller must check "regname" to be valid!
+ * "flags": PUT_FIXINDENT make indent look nice
+ * PUT_CURSEND leave cursor after end of new text
+ * PUT_LINE force linewise put (":put")
*/
void
do_put(regname, dir, count, flags)
@@ -3635,6 +3637,7 @@ end:
if (regname == '=')
vim_free(y_array);
}
+ /* If the cursor is past the end of the line put it at the end. */
if (gchar_cursor() == NUL
&& curwin->w_cursor.col > 0
&& !(restart_edit || (State & INSERT)))
diff --git a/src/search.c b/src/search.c
index 17dc5bd407..2bcdf2400b 100644
--- a/src/search.c
+++ b/src/search.c
@@ -503,8 +503,8 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
regmmatch_T regmatch;
char_u *ptr;
colnr_T matchcol;
- colnr_T startcol;
lpos_T endpos;
+ lpos_T matchpos;
int loop;
pos_T start_pos;
int at_first_line;
@@ -512,7 +512,6 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
int match_ok;
long nmatched;
int submatch = 0;
- linenr_T first_lnum;
#ifdef FEAT_SEARCH_EXTRA
int break_loop = FALSE;
#else
@@ -573,9 +572,8 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
lnum += dir, at_first_line = FALSE)
{
/*
- * Look for a match somewhere in the line.
+ * Look for a match somewhere in line "lnum".
*/
- first_lnum = lnum;
nmatched = vim_regexec_multi(&regmatch, win, buf,
lnum, (colnr_T)0);
/* Abort searching on an error (e.g., out of stack). */
@@ -584,13 +582,12 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
if (nmatched > 0)
{
/* match may actually be in another line when using \zs */
- lnum += regmatch.startpos[0].lnum;
- ptr = ml_get_buf(buf, lnum, FALSE);
- startcol = regmatch.startpos[0].col;
+ matchpos = regmatch.startpos[0];
endpos = regmatch.endpos[0];
# ifdef FEAT_EVAL
submatch = first_submatch(&regmatch);
# endif
+ ptr = ml_get_buf(buf, lnum + matchpos.lnum, FALSE);
/*
* Forward search in the first line: match should be after
@@ -601,16 +598,20 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
{
match_ok = TRUE;
/*
+ * When the match starts in a next line it's certainly
+ * past the start position.
* When match lands on a NUL the cursor will be put
* one back afterwards, compare with that position,
* otherwise "/$" will get stuck on end of line.
*/
- while ((options & SEARCH_END)
- ? (nmatched == 1
- && (int)endpos.col - 1
+ while (matchpos.lnum == 0
+ && ((options & SEARCH_END)
+ ? (nmatched == 1
+ && (int)endpos.col - 1
< (int)start_pos.col + extra_col)
- : ((int)startcol - (ptr[startcol] == NUL)
- < (int)start_pos.col + extra_col))
+ : ((int)matchpos.col
+ - (ptr[matchpos.col] == NUL)
+ < (int)start_pos.col + extra_col)))
{
/*
* If vi-compatible searching, continue at the end
@@ -628,7 +629,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
}
matchcol = endpos.col;
/* for empty match: advance one char */
- if (matchcol == startcol
+ if (matchcol == matchpos.col
&& ptr[matchcol] != NUL)
{
#ifdef FEAT_MBYTE
@@ -642,7 +643,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
}
else
{
- matchcol = startcol;
+ matchcol = matchpos.col;
if (ptr[matchcol] != NUL)
{
#ifdef FEAT_MBYTE
@@ -656,12 +657,13 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
}
if (ptr[matchcol] == NUL
|| (nmatched = vim_regexec_multi(&regmatch,
- win, buf, lnum, matchcol)) == 0)
+ win, buf, lnum + matchpos.lnum,
+ matchcol)) == 0)
{
match_ok = FALSE;
break;
}
- startcol = regmatch.startpos[0].col;
+ matchpos = regmatch.startpos[0];
endpos = regmatch.endpos[0];
# ifdef FEAT_EVAL
submatch = first_submatch(&regmatch);
@@ -669,7 +671,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
/* Need to get the line pointer again, a
* multi-line search may have made it invalid. */
- ptr = ml_get_buf(buf, lnum, FALSE);
+ ptr = ml_get_buf(buf, lnum + matchpos.lnum, FALSE);
}
if (!match_ok)
continue;
@@ -686,20 +688,29 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
match_ok = FALSE;
for (;;)
{
- if (!at_first_line
- || ((options & SEARCH_END)
- ? (nmatched == 1
- && (int)regmatch.endpos[0].col - 1
+ /* Remember a position that is before the start
+ * position, we use it if it's the last match in
+ * the line. Always accept a position after
+ * wrapping around. */
+ if (loop
+ || ((options & SEARCH_END)
+ ? (lnum + regmatch.endpos[0].lnum
+ < start_pos.lnum
+ || (lnum + regmatch.endpos[0].lnum
+ == start_pos.lnum
+ && (int)regmatch.endpos[0].col - 1
+ extra_col
- <= (int)start_pos.col)
- : ((int)regmatch.startpos[0].col
+ <= (int)start_pos.col))
+ : (lnum + regmatch.startpos[0].lnum
+ < start_pos.lnum
+ || (lnum + regmatch.startpos[0].lnum
+ == start_pos.lnum
+ && (int)regmatch.startpos[0].col
+ extra_col
- <= (int)start_pos.col)))
+ <= (int)start_pos.col))))
{
- /* Remember this position, we use it if it's
- * the last match in the line. */
match_ok = TRUE;
- startcol = regmatch.startpos[0].col;
+ matchpos = regmatch.startpos[0];
endpos = regmatch.endpos[0];
# ifdef FEAT_EVAL
submatch = first_submatch(&regmatch);
@@ -721,7 +732,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
break;
matchcol = endpos.col;
/* for empty match: advance one char */
- if (matchcol == startcol
+ if (matchcol == matchpos.col
&& ptr[matchcol] != NUL)
{
#ifdef FEAT_MBYTE
@@ -735,7 +746,10 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
}
else
{
- matchcol = startcol;
+ /* Stop when the match is in a next line. */
+ if (matchpos.lnum > 0)
+ break;
+ matchcol = matchpos.col;
if (ptr[matchcol] != NUL)
{
#ifdef FEAT_MBYTE
@@ -749,12 +763,13 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
}
if (ptr[matchcol] == NUL
|| (nmatched = vim_regexec_multi(&regmatch,
- win, buf, lnum, matchcol)) == 0)
+ win, buf, lnum + matchpos.lnum,
+ matchcol)) == 0)
break;
/* Need to get the line pointer again, a
* multi-line search may have made it invalid. */
- ptr = ml_get_buf(buf, lnum, FALSE);
+ ptr = ml_get_buf(buf, lnum + matchpos.lnum, FALSE);
}
/*
@@ -767,13 +782,13 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
if (options & SEARCH_END && !(options & SEARCH_NOOF))
{
- pos->lnum = endpos.lnum + first_lnum;
+ pos->lnum = lnum + endpos.lnum;
pos->col = endpos.col - 1;
}
else
{
- pos->lnum = lnum;
- pos->col = startcol;
+ pos->lnum = lnum + matchpos.lnum;
+ pos->col = matchpos.col;
}
#ifdef FEAT_VIRTUALEDIT
pos->coladd = 0;
@@ -781,7 +796,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
found = 1;
/* Set variables used for 'incsearch' highlighting. */
- search_match_lines = endpos.lnum - (lnum - first_lnum);
+ search_match_lines = endpos.lnum - matchpos.lnum;
search_match_endcol = endpos.col;
break;
}
diff --git a/src/structs.h b/src/structs.h
index 19cfbe5751..6482e30c89 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -936,8 +936,8 @@ typedef struct hashtable_S
{
long_u ht_mask; /* mask used for hash value (nr of items in
* array is "ht_mask" + 1) */
- int ht_used; /* number of items used */
- int ht_filled; /* number of items used + removed */
+ long_u ht_used; /* number of items used */
+ long_u ht_filled; /* number of items used + removed */
int ht_locked; /* counter for hash_lock() */
int ht_error; /* when set growing failed, can't add more
items before growing works */
diff --git a/src/version.h b/src/version.h
index 0053ec4200..3362a98775 100644
--- a/src