mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 21:25:04 -07:00
Merge #4136 vim-patch:7.4.{755,758,760}
This commit is contained in:
commit
17ae27190d
@ -1,4 +1,4 @@
|
||||
*change.txt* For Vim version 7.4. Last change: 2015 Feb 10
|
||||
*change.txt* For Vim version 7.4. Last change: 2015 Jun 25
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -366,14 +366,45 @@ Adding and subtracting ~
|
||||
CTRL-A Add [count] to the number or alphabetic character at
|
||||
or after the cursor.
|
||||
|
||||
*v_CTRL-A*
|
||||
{Visual}CTRL-A Add [count] to the number or alphabetic character in
|
||||
the highlighted text. {not in Vi}
|
||||
|
||||
*v_g_CTRL-A*
|
||||
{Visual}g CTRL-A Add [count] to the number or alphabetic character in
|
||||
the highlighted text. If several lines are
|
||||
highlighted, each one will be incremented by an
|
||||
additional [count] (so effectively creating a
|
||||
[count] incrementing sequence). {not in Vi}
|
||||
For Example, if you have this list of numbers:
|
||||
1. ~
|
||||
1. ~
|
||||
1. ~
|
||||
1. ~
|
||||
Move to the second "1." and Visually select three
|
||||
lines, pressing g CTRL-A results in:
|
||||
1. ~
|
||||
2. ~
|
||||
3. ~
|
||||
4. ~
|
||||
|
||||
*CTRL-X*
|
||||
CTRL-X Subtract [count] from the number or alphabetic
|
||||
character at or after the cursor.
|
||||
|
||||
The CTRL-A and CTRL-X commands can work for:
|
||||
- signed and unsigned decimal numbers
|
||||
- unsigned binary, octal and hexadecimal numbers
|
||||
- alphabetic characters
|
||||
*v_CTRL-X*
|
||||
{Visual}CTRL-X Subtract [count] from the number or alphabetic
|
||||
character in the highlighted text. {not in Vi}
|
||||
|
||||
*v_g_CTRL-X*
|
||||
{Visual}g CTRL-X Subtract [count] from the number or alphabetic
|
||||
character in the highlighted text. If several lines
|
||||
are highlighted, each value will be decremented by an
|
||||
additional [count] (so effectively creating a [count]
|
||||
decrementing sequence). {not in Vi}
|
||||
|
||||
The CTRL-A and CTRL-X commands work for (signed) decimal numbers, unsigned
|
||||
binary/octal/hexadecimal numbers and alphabetic characters.
|
||||
|
||||
This depends on the 'nrformats' option:
|
||||
- When 'nrformats' includes "bin", Vim assumes numbers starting with '0b' or
|
||||
|
@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.4. Last change: 2015 Nov 30
|
||||
*eval.txt* For Vim version 7.4. Last change: 2015 Jun 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -1003,7 +1003,7 @@ function. Example: >
|
||||
|
||||
|
||||
|
||||
string *string* *expr-string* *E114*
|
||||
string *string* *String* *expr-string* *E114*
|
||||
------
|
||||
"string" string constant *expr-quote*
|
||||
|
||||
@ -2028,7 +2028,7 @@ split( {expr} [, {pat} [, {keepempty}]])
|
||||
sqrt( {expr}) Float square root of {expr}
|
||||
str2float( {expr}) Float convert String to Float
|
||||
str2nr( {expr} [, {base}]) Number convert String to Number
|
||||
strchars( {expr}) Number character length of the String {expr}
|
||||
strchars( {expr} [, {skipcc}]) Number character length of the String {expr}
|
||||
strdisplaywidth( {expr} [, {col}]) Number display length of the String {expr}
|
||||
strftime( {format}[, {time}]) String time in specified format
|
||||
stridx( {haystack}, {needle}[, {start}])
|
||||
@ -6157,15 +6157,17 @@ str2nr( {expr} [, {base}]) *str2nr()*
|
||||
Text after the number is silently ignored.
|
||||
|
||||
|
||||
strchars({expr}) *strchars()*
|
||||
strchars({expr} [, {skipcc}]) *strchars()*
|
||||
The result is a Number, which is the number of characters
|
||||
String {expr} occupies. Composing characters are counted
|
||||
separately.
|
||||
in String {expr}.
|
||||
When {skipcc} is omitted or zero, composing characters are
|
||||
counted separately.
|
||||
When {skipcc} set to 1, Composing characters are ignored.
|
||||
Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
|
||||
|
||||
strdisplaywidth({expr}[, {col}]) *strdisplaywidth()*
|
||||
The result is a Number, which is the number of display cells
|
||||
String {expr} occupies on the screen when it starts a {col}.
|
||||
String {expr} occupies on the screen when it starts at {col}.
|
||||
When {col} is omitted zero is used. Otherwise it is the
|
||||
screen column where to start. This matters for Tab
|
||||
characters.
|
||||
@ -6231,15 +6233,11 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number,
|
||||
*strlen()*
|
||||
strlen({expr}) The result is a Number, which is the length of the String
|
||||
{expr} in bytes.
|
||||
If you want to count the number of multi-byte characters (not
|
||||
counting composing characters) use something like this: >
|
||||
|
||||
:let len = strlen(substitute(str, ".", "x", "g"))
|
||||
<
|
||||
If the argument is a Number it is first converted to a String.
|
||||
For other types an error is given.
|
||||
Also see |len()|, |strchars()|, |strdisplaywidth()| and
|
||||
|strwidth()|.
|
||||
If you want to count the number of multi-byte characters use
|
||||
|strchars()|.
|
||||
Also see |len()|, |strdisplaywidth()| and |strwidth()|.
|
||||
|
||||
strpart({src}, {start}[, {len}]) *strpart()*
|
||||
The result is a String, which is part of {src}, starting from
|
||||
|
@ -1,4 +1,4 @@
|
||||
*insert.txt* For Vim version 7.4. Last change: 2015 May 22
|
||||
*insert.txt* For Vim version 7.4. Last change: 2015 Jun 20
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -78,7 +78,7 @@ CTRL-W Delete the word before the cursor (see |i_backspacing| about
|
||||
|word-motions|, for the definition of a word.
|
||||
*i_CTRL-U*
|
||||
CTRL-U Delete all entered characters before the cursor in the current
|
||||
line. If there are no newly entereed characters and
|
||||
line. If there are no newly entered characters and
|
||||
'backspace' is not empty, delete all characters before the
|
||||
cursor in the current line.
|
||||
See |i_backspacing| about joining lines.
|
||||
|
@ -3045,12 +3045,13 @@ static int do_lock_var(lval_T *lp, char_u *name_end, int deep, int lock)
|
||||
li = li->li_next;
|
||||
++lp->ll_n1;
|
||||
}
|
||||
} else if (lp->ll_list != NULL)
|
||||
/* (un)lock a List item. */
|
||||
} else if (lp->ll_list != NULL) {
|
||||
// (un)lock a List item.
|
||||
item_lock(&lp->ll_li->li_tv, deep, lock);
|
||||
else
|
||||
/* un(lock) a Dictionary item. */
|
||||
} else {
|
||||
// (un)lock a Dictionary item.
|
||||
item_lock(&lp->ll_di->di_tv, deep, lock);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -7337,7 +7338,7 @@ static struct fst {
|
||||
{ "sqrt", 1, 1, f_sqrt },
|
||||
{ "str2float", 1, 1, f_str2float },
|
||||
{ "str2nr", 1, 2, f_str2nr },
|
||||
{ "strchars", 1, 1, f_strchars },
|
||||
{ "strchars", 1, 2, f_strchars },
|
||||
{ "strdisplaywidth", 1, 2, f_strdisplaywidth },
|
||||
{ "strftime", 1, 2, f_strftime },
|
||||
{ "stridx", 2, 3, f_stridx },
|
||||
@ -16213,14 +16214,24 @@ static void f_strlen(typval_T *argvars, typval_T *rettv)
|
||||
static void f_strchars(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
char_u *s = get_tv_string(&argvars[0]);
|
||||
int skipcc = 0;
|
||||
varnumber_T len = 0;
|
||||
int (*func_mb_ptr2char_adv)(char_u **pp);
|
||||
|
||||
if (argvars[1].v_type != VAR_UNKNOWN) {
|
||||
skipcc = get_tv_number_chk(&argvars[1], NULL);
|
||||
}
|
||||
if (skipcc < 0 || skipcc > 1) {
|
||||
EMSG(_(e_invarg));
|
||||
} else {
|
||||
func_mb_ptr2char_adv = skipcc ? mb_ptr2char_adv : mb_cptr2char_adv;
|
||||
while (*s != NUL) {
|
||||
mb_cptr2char_adv(&s);
|
||||
func_mb_ptr2char_adv(&s);
|
||||
++len;
|
||||
}
|
||||
rettv->vval.v_number = len;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* "strdisplaywidth()" function
|
||||
|
@ -5136,6 +5136,8 @@ static int ex_window(void)
|
||||
|
||||
/* Don't execute autocommands while deleting the window. */
|
||||
block_autocmds();
|
||||
// Avoid command-line window first character being concealed
|
||||
curwin->w_p_cole = 0;
|
||||
wp = curwin;
|
||||
bp = curbuf;
|
||||
win_goto(old_curwin);
|
||||
|
@ -3004,14 +3004,19 @@ static void syn_cmd_spell(exarg_T *eap, int syncing)
|
||||
return;
|
||||
|
||||
next = skiptowhite(arg);
|
||||
if (STRNICMP(arg, "toplevel", 8) == 0 && next - arg == 8)
|
||||
if (STRNICMP(arg, "toplevel", 8) == 0 && next - arg == 8) {
|
||||
curwin->w_s->b_syn_spell = SYNSPL_TOP;
|
||||
else if (STRNICMP(arg, "notoplevel", 10) == 0 && next - arg == 10)
|
||||
} else if (STRNICMP(arg, "notoplevel", 10) == 0 && next - arg == 10) {
|
||||
curwin->w_s->b_syn_spell = SYNSPL_NOTOP;
|
||||
else if (STRNICMP(arg, "default", 7) == 0 && next - arg == 7)
|
||||
} else if (STRNICMP(arg, "default", 7) == 0 && next - arg == 7) {
|
||||
curwin->w_s->b_syn_spell = SYNSPL_DEFAULT;
|
||||
else
|
||||
} else {
|
||||
EMSG2(_("E390: Illegal argument: %s"), arg);
|
||||
return;
|
||||
}
|
||||
|
||||
// assume spell checking changed, force a redraw
|
||||
redraw_win_later(curwin, NOT_VALID);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -528,12 +528,12 @@ static int included_patches[] = {
|
||||
// 763 NA
|
||||
// 762 NA
|
||||
// 761 NA
|
||||
// 760,
|
||||
760,
|
||||
// 759 NA
|
||||
// 758,
|
||||
758,
|
||||
// 757 NA
|
||||
// 756 NA
|
||||
// 755,
|
||||
755,
|
||||
754,
|
||||
753,
|
||||
// 752,
|
||||
|
@ -3,6 +3,7 @@
|
||||
local helpers = require('test.functional.helpers')
|
||||
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
||||
local execute, expect = helpers.execute, helpers.expect
|
||||
local eq, eval = helpers.eq, helpers.eval
|
||||
|
||||
describe('utf8', function()
|
||||
setup(clear)
|
||||
@ -27,4 +28,26 @@ describe('utf8', function()
|
||||
xあああ
|
||||
bxbb]])
|
||||
end)
|
||||
|
||||
it('strchars()', function()
|
||||
eq(1, eval('strchars("a")'))
|
||||
eq(1, eval('strchars("a", 0)'))
|
||||
eq(1, eval('strchars("a", 1)'))
|
||||
|
||||
eq(3, eval('strchars("あいa")'))
|
||||
eq(3, eval('strchars("あいa", 0)'))
|
||||
eq(3, eval('strchars("あいa", 1)'))
|
||||
|
||||
eq(2, eval('strchars("A\\u20dd")'))
|
||||
eq(2, eval('strchars("A\\u20dd", 0)'))
|
||||
eq(1, eval('strchars("A\\u20dd", 1)'))
|
||||
|
||||
eq(3, eval('strchars("A\\u20dd\\u20dd")'))
|
||||
eq(3, eval('strchars("A\\u20dd\\u20dd", 0)'))
|
||||
eq(1, eval('strchars("A\\u20dd\\u20dd", 1)'))
|
||||
|
||||
eq(1, eval('strchars("\\u20dd")'))
|
||||
eq(1, eval('strchars("\\u20dd", 0)'))
|
||||
eq(1, eval('strchars("\\u20dd", 1)'))
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user