diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-06-03 01:55:18 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-11 15:36:03 +0100 |
commit | 90a4cf92d21b730fea7099fb3e12a9ef791a1a57 (patch) | |
tree | c342ec4595fd613430bff9e7a6924c7ee3291c71 /runtime | |
parent | 10018958d860780c3766f4e785710201c07f3684 (diff) | |
download | rneovim-90a4cf92d21b730fea7099fb3e12a9ef791a1a57.tar.gz rneovim-90a4cf92d21b730fea7099fb3e12a9ef791a1a57.tar.bz2 rneovim-90a4cf92d21b730fea7099fb3e12a9ef791a1a57.zip |
vim-patch:8.2.0886: cannot use octal numbers in scriptversion 4
Problem: Cannot use octal numbers in scriptversion 4.
Solution: Add the "0o" notation. (Ken Takata, closes vim/vim#5304)
https://github.com/vim/vim/commit/c17e66c5c0acd5038f1eb3d7b3049b64bb6ea30b
:scriptversion is N/A.
Cherry-pick latest str2nr() doc changes from v8.1.2035.
Cherry-pick various mentions of the 0o prefix from:
- v8.2.2324
- https://github.com/vim/vim/commit/2346a6378483c9871016f9fc821ec5cbea638f13
- https://github.com/vim/vim/commit/11e3c5ba820325b69cb56f70e13c21d7b8808d33
- https://github.com/vim/vim/commit/82be4849eed0b8fbee45bc8da99b685ec89af59a
Patch used ascii_isbdigit() by mistake, which was fixed in v8.2.2309.
Make STR2NR_OOCT work the same as STR2NR_OCT when forcing.
In Vim, STR2NR_FORCE | STR2NR_OOCT isn't handled, and doesn't actually
force anything. Rather than abort(), make it work as STR2NR_OCT.
This means STR2NR_FORCE | STR2NR_OCT works the same as
STR2NR_FORCE | STR2NR_OOCT and STR2NR_FORCE | STR2NR_OCT | STR2NR_OOCT.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 23 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 9 |
2 files changed, 17 insertions, 15 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index cd449a5d34..d2e476b83b 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -20,7 +20,7 @@ There are six types of variables: *Number* *Integer* Number A 32 or 64 bit signed number. |expr-number| The number of bits is available in |v:numbersize|. - Examples: -123 0x10 0177 0b1011 + Examples: -123 0x10 0177 0o177 0b1011 Float A floating point number. |floating-point-format| *Float* Examples: 123.456 1.15e-6 -1.1e3 @@ -54,14 +54,15 @@ the Number. Examples: Number -1 --> String "-1" ~ *octal* Conversion from a String to a Number is done by converting the first digits to -a number. Hexadecimal "0xf9", Octal "017", and Binary "0b10" numbers are -recognized. If the String doesn't start with digits, the result is zero. -Examples: +a number. Hexadecimal "0xf9", Octal "017" or "0o17", and Binary "0b10" +numbers are recognized. If the String doesn't start with digits, the result +is zero. Examples: String "456" --> Number 456 ~ String "6bar" --> Number 6 ~ String "foo" --> Number 0 ~ String "0xf1" --> Number 241 ~ String "0100" --> Number 64 ~ + String "0o100" --> Number 64 ~ String "0b101" --> Number 5 ~ String "-8" --> Number -8 ~ String "+8" --> Number 0 ~ @@ -1085,7 +1086,7 @@ number number constant *expr-number* *hex-number* *octal-number* *binary-number* Decimal, Hexadecimal (starting with 0x or 0X), Binary (starting with 0b or 0B) -and Octal (starting with 0). +and Octal (starting with 0, 0o or 0O). *floating-point-format* Floating point numbers can be written in two forms: @@ -6554,9 +6555,9 @@ mkdir({name} [, {path} [, {prot}]]) If {path} is "p" then intermediate directories are created as necessary. Otherwise it must be "". If {prot} is given it is used to set the protection bits of - the new directory. The default is 0755 (rwxr-xr-x: r/w for - the user readable for others). Use 0700 to make it unreadable - for others. + the new directory. The default is 0o755 (rwxr-xr-x: r/w for + the user, readable for others). Use 0o700 to make it + unreadable for others. {prot} is applied for all parts of {name}. Thus if you create /tmp/foo/bar then /tmp/foo will be created with 0700. Example: > @@ -8650,9 +8651,9 @@ str2nr({expr} [, {base} [, {quoted}]]) *str2nr()* let nr = str2nr('123') < When {base} is 16 a leading "0x" or "0X" is ignored. With a - different base the result will be zero. Similarly, when {base} - is 8 a leading "0" is ignored, and when {base} is 2 a leading - "0b" or "0B" is ignored. + different base the result will be zero. Similarly, when + {base} is 8 a leading "0", "0o" or "0O" is ignored, and when + {base} is 2 a leading "0b" or "0B" is ignored. Text after the number is silently ignored. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index a190bf2f27..c9321e8736 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -118,7 +118,8 @@ Numbers can be decimal, hexadecimal, octal or binary. A hexadecimal number starts with "0x" or "0X". For example "0x1f" is decimal 31. -An octal number starts with a zero and another digit. "017" is decimal 15. +An octal number starts with "0o", "0O" or a zero and another digit. "0o17" is +decimal 15. A binary number starts with "0b" or "0B". For example "0b101" is decimal 5. @@ -127,14 +128,14 @@ number, it will be interpreted as an octal number! The ":echo" command always prints decimal numbers. Example: > - :echo 0x7f 036 + :echo 0x7f 0o36 < 127 30 ~ A number is made negative with a minus sign. This also works for hexadecimal, octal and binary numbers. A minus sign is also used for subtraction. Compare this with the previous example: > - :echo 0x7f -036 + :echo 0x7f -0o36 < 97 ~ White space in an expression is ignored. However, it's recommended to use it @@ -142,7 +143,7 @@ for separating items, to make the expression easier to read. For example, to avoid the confusion with a negative number above, put a space between the minus sign and the following number: > - :echo 0x7f - 036 + :echo 0x7f - 0o36 ============================================================================== *41.2* Variables |