Compare commits

...

55 Commits

Author SHA1 Message Date
Kazuki Sakamoto 1afdb997de MacVim Snapshot 131
Binary targets macOS 10.8+

- Vim patch 8.0.0567
- Fix artifacts when entering full screen
- Fix flashing during window resizing

Script interfaces have compatibility with these versions

- Lua 5.2
- Perl 5.16
- Python2 2.7
- Python3 3.6.1
- Ruby 2.0
2017-04-18 20:37:38 -07:00
Kazuki Sakamoto 701ac80cae Merge remote-tracking branch 'vim/master' 2017-04-18 19:24:12 -07:00
Bram Moolenaar fc8f1118e7 patch 8.0.0567: call for requesting color and ambiwidth is too early
Problem:    Call for requesting color and ambiwidth is too early. (Hirohito
            Higashi)
Solution:   Move the call down to below resetting "starting".
2017-04-18 18:51:35 +02:00
Kazuki Sakamoto 52a9a472de Merge remote-tracking branch 'vim/master' 2017-04-15 21:50:24 -07:00
Bram Moolenaar 43d1ac6e81 patch 8.0.0566: setting nocompatible for the tiny version moves the cursor
Problem:    Setting nocompatible for the tiny version moves the cursor.
Solution:   Use another trick to skip commands when the +eval feature is
            present. (Christian Brabandt, closes #1630)
2017-04-15 15:37:25 +02:00
Bram Moolenaar 31bdd13c33 patch 8.0.0565: using freed memory in :caddbuf
Problem:    Using freed memory in :caddbuf after clearing quickfix list.
            (Dominique Pelle)
Solution:   Set qf_last to NULL.
2017-04-15 15:22:52 +02:00
Bram Moolenaar 39170e2d97 patch 8.0.0564: cannot detect Bazel BUILD files on some systems
Problem:    Cannot detect Bazel BUILD files on some systems.
Solution:   Check for BUILD after script checks. (Issue #1340)
2017-04-15 14:36:07 +02:00
Kazuki Sakamoto 957bedab9c Merge remote-tracking branch 'vim/master' 2017-04-11 22:51:13 -07:00
Bram Moolenaar 9f92886277 patch 8.0.0563: crash when getting the window position in tmux
Problem:    Crash when getting the window position in tmux. (Marvin Schmidt)
Solution:   Add t_GP to the list of terminal options. (closes #1627)
2017-04-11 22:44:05 +02:00
Kazuki Sakamoto 4f54a3d2c2 Merge remote-tracking branch 'vim/master' 2017-04-10 19:20:00 -07:00
Bram Moolenaar ea588154d0 patch 8.0.0562: not enough test coverage for syntax commands
Problem:    Not enough test coverage for syntax commands.
Solution:   Add a few more tests. (Dominique Pelle, closes #1624)
2017-04-10 22:45:30 +02:00
Bram Moolenaar 478af67dd6 patch 8.0.0561: undefined behavior when using backslash after empty line
Problem:    Undefined behavior when using backslash after empty line.
Solution:   Check for an empty line. (Dominique Pelle, closes #1631)
2017-04-10 22:22:42 +02:00
Bram Moolenaar 451a4a1cb7 patch 8.0.0560: :windo allows for ! but it's not supported
Problem:    :windo allows for ! but it's not supported.
Solution:   Disallow passing !. (Hirohito Higashi)
2017-04-10 21:46:38 +02:00
Kazuki Sakamoto 23c70e0101 Merge pull request #495 from s4y/s4y/fullscreen_contentSize
Fix changing font size in full screen.
2017-04-09 18:10:36 -07:00
Kazuki Sakamoto 487dd9d27b Merge remote-tracking branch 'vim/master' 2017-04-09 15:51:52 -07:00
Bram Moolenaar f803a76978 patch 8.0.0559: setting ttytype to xxx does not always fail
Problem:    Setting ttytype to xxx does not always fail as expected. (Marvin
            Schmidt)
Solution:   Catch both possible errors. (closes #1601)
2017-04-09 22:54:13 +02:00
Bram Moolenaar cd5c8f8250 Update runtime files. 2017-04-09 20:11:58 +02:00
Bram Moolenaar f8ec998613 patch 8.0.0558: :ownsyntax is not tested
Problem:    The :ownsyntax command is not tested.
Solution:   Add a test. (Dominique Pelle, closes #1622)
2017-04-09 15:41:31 +02:00
Bram Moolenaar 59053e1d9f patch 8.0.0557: GTK: using static gravities is not useful
Problem:    GTK: using static gravities is not useful.
Solution:   Remove setting static gravities. (Kazunobu Kuriyama)
2017-04-09 15:27:09 +02:00
Bram Moolenaar 7860bac57b patch 8.0.0556: getting window position fails if GUI and term possible
Problem:    Getting the window position fails if both the GUI and term
            code is built in.
Solution:   Return after getting the GUI window position. (Kazunobu Kuriyama)
2017-04-09 15:03:15 +02:00
Bram Moolenaar d2381a2cad patch 8.0.0555: toupper/tolower test fails on OSX without Darwin
Problem:    Toupper/tolower test fails on OSX without Darwin.
Solution:   Skip that part of the test also for OSX. (Kazunobu Kuriyama)
2017-04-09 14:58:15 +02:00
Bram Moolenaar 1cc482069a patch 8.0.0554: toupper and tolower don't work properly for Turkish
Problem:    Toupper and tolower don't work properly for Turkish when 'casemap'
            contains "keepascii". (Bjorn Linse)
Solution:   When 'casemap' contains "keepascii" use ASCII toupper/tolower.
2017-04-09 13:41:59 +02:00
Bram Moolenaar 9f4de1f543 patch 8.0.0553: toupper/tolower test fails on Mac
Problem:    Toupper/tolower test with Turkish locale fails on Mac.
Solution:   Skip the test on Mac.
2017-04-08 19:39:43 +02:00
Bram Moolenaar 3317d5ebbe patch 8.0.0552: toupper and tolower don't work properly for Turkish
Problem:    Toupper and tolower don't work properly for Turkish when 'casemap'
            is empty. (Bjorn Linse)
Solution:   Check the 'casemap' options when deciding how to upper/lower case.
2017-04-08 19:12:06 +02:00
Bram Moolenaar d34f9b1155 patch 8.0.0551: the typeahead buffer is reallocated too often
Problem:    The typeahead buffer is reallocated too often.
Solution:   Re-use the existing buffer if possible.
2017-04-08 18:41:13 +02:00
Bram Moolenaar 9585a1655b patch 8.0.0550: cannot parse some etags format tags file
Problem:    Some etags format tags file use 0x01, breaking the parsing.
Solution:   Use 0x02 for TAG_SEP. (James McCoy, closes #1614)
2017-04-07 20:30:29 +02:00
Bram Moolenaar 395b6bab33 patch 8.0.0549: no test for the 8g8 command
Problem:    No test for the 8g8 command.
Solution:   Add a test. (Dominique Pelle, closes #1615)
2017-04-07 20:09:51 +02:00
Bram Moolenaar d4863aa99e patch 8.0.0548: saving the redo buffer only works one time
Problem:    Saving the redo buffer only works one time, resulting in the "."
            command not working well for a function call inside another
            function call. (Ingo Karkat)
Solution:   Save the redo buffer at every user function call. (closes #1619)
2017-04-07 19:50:12 +02:00
Bram Moolenaar 52604f2454 patch 8.0.0547: extra line break in verbosefile
Problem:    Extra line break in verbosefile when using ":echomsg". (Ingo
            Karkat)
Solution:   Don't call msg_start(). (closes #1618)
2017-04-07 16:17:39 +02:00
Bram Moolenaar 3bab93998d patch 8.0.0546: swap file exists briefly when opening the command window
Problem:    Swap file exists briefly when opening the command window.
Solution:   Set the noswapfile command modifier before splitting the window.
            (James McCoy, closes #1620)
2017-04-07 15:42:25 +02:00
Bram Moolenaar 15ecbd6f3d patch 8.0.0545: edit test may fail on some systems
Problem:    Edit test may fail on some systems.
Solution:   If creating a directory with a very long path fails, bail out.
2017-04-07 14:10:48 +02:00
Bram Moolenaar 866c688610 patch 8.0.0544: cppcheck warnings
Problem:    Cppcheck warnings.
Solution:   Use temp variable. Change NUL to NULL. Swap conditions. (Dominique
            Pelle)
2017-04-07 14:02:01 +02:00
Bram Moolenaar ba6ec18297 patch 8.0.0543: test_edit causes older xfce4-terminal to close
Problem:    Test_edit causes older xfce4-terminal to close. (Dominique Pelle)
Solution:   Reduce number of columns to 2000.  Try to restore the window
            position.
2017-04-04 22:41:10 +02:00
Bram Moolenaar a1d5fa65bc patch 8.0.0542: getpos() can return a negative line number
Problem:    getpos() can return a negative line number. (haya14busa)
Solution:   Handle a zero topline and botline. (closes #1613)
2017-04-03 22:02:55 +02:00
Bram Moolenaar 04000560ca patch 8.0.0541: compiler warning on MS-Windows
Problem:    Compiler warning on MS-Windows.
Solution:   Add a type cast. (Mike Williams)
2017-04-03 21:35:42 +02:00
Sidney San Martín 6d2e8f8dca Choose how to resize the Vim view based on the full screen mode.
- Native full screen: Use the last externally-set window size. This lets
  Split View work without slowly growing or shrinking.

- Non-native full screen: Use the size of the full screen window.

- Not full screen: Use [vimView desiredSize] (unchanged).

This is somewhat nasty, but the different full screen code paths behave
differently enough that there doesn't seem to be one universally-correct
answer. It would be great to simplify them.
2017-04-03 14:31:00 -04:00
Bram Moolenaar a604429529 patch 8.0.0540: building unit tests fails
Problem:    Building unit tests fails.
Solution:   Move params outside of #ifdef.
2017-04-02 18:19:53 +02:00
Bram Moolenaar 08f88b139d patch 8.0.0539: startup test fails on Mac
Problem:    Startup test fails on Mac.
Solution:   Use another term name, "unknown" is known. Avoid a 2 second delay.
2017-04-02 17:21:16 +02:00
Bram Moolenaar 85045a73db patch 8.0.0538: no test for falling back to default term value
Problem:    No test for falling back to default term value.
Solution:   Add a test.
2017-04-02 16:54:09 +02:00
Bram Moolenaar fa0ad0bb0b patch 8.0.0537: illegal memory access with :z and large count
Problem:    Illegal memory access with :z and large count.
Solution:   Check for number overflow, using long instead of int. (Dominique
            Pelle, closes #1612)
2017-04-02 15:45:17 +02:00
Bram Moolenaar 69f40be645 patch 8.0.0536: quickfix window not updated when freeing quickfix stack
Problem:    Quickfix window not updated when freeing quickfix stack.
Solution:   Update the quickfix window. (Yegappan Lakshmanan)
2017-04-02 15:15:49 +02:00
Bram Moolenaar 6914c64ee5 patch 8.0.0535: memory leak when exiting from within a user function
Problem:    Memory leak when exiting from within a user function.
Solution:   Clear the function call stack on exit.
2017-04-01 21:21:30 +02:00
Bram Moolenaar 33ccb24cf7 patch 8.0.0534: defaults.vim does not work well with tiny features
Problem:    Defaults.vim does not work well with tiny features. (crd477)
Solution:   When the +eval feature is not available always reset 'compatible'.
2017-04-01 16:59:29 +02:00
Bram Moolenaar 878c263a48 patch 8.0.0533: abbreviation doesn't work after backspacing newline
Problem:    Abbreviation doesn't work after backspacing newline. (Hkonrk)
Solution:   Set the insert start column. (closes #1609)
2017-04-01 15:15:52 +02:00
Bram Moolenaar c77d675747 patch 8.0.0532: test with long directory name fails on Mac
Problem:    Test with long directory name fails on Mac.
Solution:   Skip the test on Mac systems.
2017-04-01 14:13:14 +02:00
Bram Moolenaar 9b81079ddd patch 8.0.0531: test with long directory name fails on non-unix systems
Problem:    Test with long directory name fails on non-unix systems.
Solution:   Skip the test on non-unix systems.
2017-03-31 23:32:53 +02:00
Bram Moolenaar 658a3a2caf patch 8.0.0530: buffer overflow when 'columns' is very big
Problem:    Buffer overflow when 'columns' is very big. (Nikolai Pavlov)
Solution:   Correctly compute where to truncate.  Fix translation.
            (closes #1600)
2017-03-31 22:27:12 +02:00
Kazuki Sakamoto 30f517fd68 Merge pull request #487 from s4y/s4y/fullscreen_flicker
Fix artifacts when entering full screen.
2017-03-31 13:24:05 -07:00
Kazuki Sakamoto 5daca9c5c6 Merge pull request #486 from s4y/s4y/resize_flicker
Fix flashing during window resizing.
2017-03-31 13:23:12 -07:00
Sidney San Martín 32e1fc9b2d Fix artifacts when entering full screen.
This changes MMFullScreenWindow to release the fade in a completion
handler for the current transaction, so that the app flushes updates
while the screen is black. It also fixes up the fadeReservationTime math
and bumps the slack to a full second so that a slightly slow draw
doesn't cause artifacts (in practice, the fade will be released as soon
as the window draws — the reservation time is just a failsafe).
2017-03-31 15:28:03 -04:00
Sidney San Martín 3fb41ccae8 Fix flashing during window resizing.
The root cause of flashing/flickering was that on each resize event,
AppKit called drawRect: on the MMCoreTextView, expecting it to fill an
empty, newly-sized buffer with content. It has nothing to draw, so the
view would show up as black until the BatchDrawMsgID reply arrived from
the backend and triggered another draw. (The MMCoreTextView was
display:ed twice for each resize).

This change does three things:

1. Implements -[MMCoreTextView setFrameSize:] to begin an
   NSAnimationContext grouping before calling super, which postpones
   display:/drawRect: until the grouping ends, and ends the grouping in
   performBatchDrawWithData:.

2. Makes *all* resize messages sent to the backend synchronous, with a
   1s timeout. This seems bad, but actually helps avoid spamming the
   backend with resize events, since the app only generates resize
   events as fast as we handle them (i.e. if we take time to process one
   resize, then the next resize event will have the current size of the
   window, potentially skipping a bunch in the middle that the backend
   never would have had time to handle).

3. Gets rid of some hacks resolved by 1 and 2, like MKVimController
   delaying the call to -[MMWindowController presentWindow:].
2017-03-31 14:06:00 -04:00
Bram Moolenaar 13489b9c41 patch 8.0.0529: line in test commented out
Problem:    Line in test commented out.
Solution:   Uncomment the lines for character classes that were failing before
            8.0.0519. (Dominique Pelle, closes #1599)
2017-03-30 22:20:29 +02:00
Bram Moolenaar ef8eb08978 patch 8.0.0528: highlight wrong text when 'wim' includes "longest"
Problem:    When 'wildmenu' is set and 'wildmode' has "longest" then the first
            file name is highlighted, even though the text shows the longest
            match.
Solution:   Do not highlight the first match. (LemonBoy, closes #1602)
2017-03-30 22:04:55 +02:00
Bram Moolenaar ce5c274201 patch 8.0.0527: leftover file from RISC OS
Problem:    RISC OS support was removed long ago, but one file is still
            included.
Solution:   Delete the file. (Thomas Dziedzic, closes #1603)
2017-03-30 21:51:31 +02:00
Bram Moolenaar 85325f839a patch 8.0.0526: Coverity complains about possible negative value
Problem:    Coverity complains about possible negative value.
Solution:   Check return value of ftell() not to be negative.
2017-03-30 21:18:45 +02:00
66 changed files with 1310 additions and 560 deletions
-1
View File
@@ -725,7 +725,6 @@ EXTRA = \
farsi/README.txt \
farsi/fonts/*/far-* \
runtime/vimlogo.xpm \
src/swis.s \
src/tee/Makefile \
src/tee/Make_mvc.mak \
src/tee/tee.c \
+15 -8
View File
@@ -1,7 +1,8 @@
" Vim compiler file
" Compiler: reStructuredText Documentation Format
" Compiler: sphinx >= 1.0.8, http://www.sphinx-doc.org
" Description: reStructuredText Documentation Format
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2006-04-19
" Latest Revision: 2017-03-31
if exists("current_compiler")
finish
@@ -11,12 +12,18 @@ let current_compiler = "rst"
let s:cpo_save = &cpo
set cpo&vim
setlocal errorformat=
\%f:%l:\ (%tEBUG/0)\ %m,
\%f:%l:\ (%tNFO/1)\ %m,
\%f:%l:\ (%tARNING/2)\ %m,
\%f:%l:\ (%tRROR/3)\ %m,
\%f:%l:\ (%tEVERE/3)\ %m,
if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet errorformat=
\%f\\:%l:\ %tEBUG:\ %m,
\%f\\:%l:\ %tNFO:\ %m,
\%f\\:%l:\ %tARNING:\ %m,
\%f\\:%l:\ %tRROR:\ %m,
\%f\\:%l:\ %tEVERE:\ %m,
\%f\\:%s:\ %tARNING:\ %m,
\%f\\:%s:\ %tRROR:\ %m,
\%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
\%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
\%DMaking\ %*\\a\ in\ %f
+7 -1
View File
@@ -1,7 +1,7 @@
" The default vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2017 Mar 08
" Last change: 2017 Apr 12
"
" This is loaded if no vimrc file was found.
" Except when Vim is run with "-u NONE" or "-C".
@@ -26,6 +26,12 @@ if &compatible
set nocompatible
endif
" When the +eval feature is missing, the set command above will be skipped.
" Use a trick to reset compatible only when the +eval feature is missing.
silent! while 0
set nocompatible
silent! endwhile
" Allow backspacing over everything in insert mode.
set backspace=indent,eol,start
+2 -2
View File
@@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 8.0. Last change: 2017 Jan 14
*autocmd.txt* For Vim version 8.0. Last change: 2017 Apr 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -621,7 +621,7 @@ FileChangedShell When Vim notices that the modification time of
to tell Vim what to do next.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer that was changed "<afile>".
buffer that was changed, which is in "<afile>".
NOTE: The commands must not change the current
buffer, jump to another buffer or delete a
buffer. *E246* *E811*
+55 -17
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.0. Last change: 2017 Mar 27
*eval.txt* For Vim version 8.0. Last change: 2017 Apr 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4379,12 +4379,14 @@ getcurpos() Get the position of the cursor. This is like getpos('.'), but
includes an extra item in the list:
[bufnum, lnum, col, off, curswant] ~
The "curswant" number is the preferred column when moving the
cursor vertically.
cursor vertically. Also see |getpos()|.
This can be used to save and restore the cursor position: >
let save_cursor = getcurpos()
MoveTheCursorAround
call setpos('.', save_cursor)
<
< Note that this only works within the window. See
|winrestview()| for restoring more state.
*getcwd()*
getcwd([{winnr} [, {tabnr}]])
The result is a String, which is the name of the current
@@ -4682,13 +4684,16 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
<
*getwinposx()*
getwinposx() The result is a Number, which is the X coordinate in pixels of
the left hand side of the GUI Vim window. The result will be
-1 if the information is not available.
the left hand side of the GUI Vim window. Also works for an
xterm.
The result will be -1 if the information is not available.
The value can be used with `:winpos`.
*getwinposy()*
getwinposy() The result is a Number, which is the Y coordinate in pixels of
the top of the GUI Vim window. The result will be -1 if the
information is not available.
the top of the GUI Vim window. Also works for an xterm.
The result will be -1 if the information is not available.
The value can be used with `:winpos`.
getwininfo([{winid}]) *getwininfo()*
Returns information about windows as a List with Dictionaries.
@@ -5304,13 +5309,29 @@ json_decode({string}) *json_decode()*
in Vim values. See |json_encode()| for the relation between
JSON and Vim values.
The decoding is permissive:
- A trailing comma in an array and object is ignored.
- A trailing comma in an array and object is ignored, e.g.
"[1, 2, ]" is the same as "[1, 2]".
- More floating point numbers are recognized, e.g. "1." for
"1.0".
However, a duplicate key in an object is not allowed. *E938*
The result must be a valid Vim type:
- An empty object member name is not allowed.
- Duplicate object member names are not allowed.
"1.0", or "001.2" for "1.2". Special floating point values
"Infinity" and "NaN" (capitalization ignored) are accepted.
- Leading zeroes in integer numbers are ignored, e.g. "012"
for "12" or "-012" for "-12".
- Capitalization is ignored in literal names null, true or
false, e.g. "NULL" for "null", "True" for "true".
- Control characters U+0000 through U+001F which are not
escaped in strings are accepted, e.g. " " (tab
character in string) for "\t".
- Backslash in an invalid 2-character sequence escape is
ignored, e.g. "\a" is decoded as "a".
- A correct surrogate pair in JSON strings should normally be
a 12 character sequence such as "\uD834\uDD1E", but
json_decode() silently accepts truncated surrogate pairs
such as "\uD834" or "\uD834\u"
*E938*
A duplicate key in an object, valid in rfc7159, is not
accepted by json_decode() as the result must be a valid Vim
type, e.g. this fails: {"a":"b", "a":"c"}
json_encode({expr}) *json_encode()*
Encode {expr} as JSON and return this as a string.
@@ -5413,8 +5434,10 @@ line({expr}) The result is a Number, which is the line number of the file
$ the last line in the current buffer
'x position of mark x (if the mark is not set, 0 is
returned)
w0 first line visible in current window
w$ last line visible in current window
w0 first line visible in current window (one if the
display isn't updated, e.g. in silent Ex mode)
w$ last line visible in current window (this is one
less than "w0" if no lines are visible)
v In Visual mode: the start of the Visual area (the
cursor is the end). When not in Visual mode
returns the cursor position. Differs from |'<| in
@@ -7877,7 +7900,6 @@ test_override({name}, {val}) *test_override()*
name effect when {val} is non-zero ~
redraw disable the redrawing() function
silent_mode enable silent mode (like using |-s| after |-e|)
char_avail disable the char_avail() function
ALL clear all overrides ({val} is not used)
@@ -8473,7 +8495,7 @@ listcmds Compiled with commands for the buffer list |:files|
and the argument list |arglist|.
localmap Compiled with local mappings and abbr. |:map-local|
lua Compiled with Lua interface |Lua|.
mac Any Macintosh version of Vim.
mac Any Macintosh version of Vim, but not all OS X.
macunix Compiled for OS X, with darwin
osx Compiled for OS X, with or without darwin
menu Compiled with support for |:menu|.
@@ -10652,6 +10674,22 @@ missing: >
: echo "You will _never_ see this message"
:endif
To execute a command only when the |+eval| feature is disabled requires a trick,
as this example shows: >
if 1
nnoremap : :"
endif
normal :set history=111<CR>
if 1
nunmap :
endif
The "<CR>" here is a real CR character, type CTRL-V Enter to get it.
When the |+eval| feature is available the ":" is remapped to add a double
quote, which has the effect of commenging-out the command. without the
|+eval| feature the nnoremap command is skipped and the command is executed.
==============================================================================
11. The sandbox *eval-sandbox* *sandbox* *E48*
+3 -2
View File
@@ -1,4 +1,4 @@
*insert.txt* For Vim version 8.0. Last change: 2016 Jan 31
*insert.txt* For Vim version 8.0. Last change: 2017 Apr 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -159,7 +159,8 @@ CTRL-R CTRL-R {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-R*
CTRL-R CTRL-O {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-O*
Insert the contents of a register literally and don't
auto-indent. Does the same as pasting with the mouse
|<MiddleMouse>|.
|<MiddleMouse>|. When the register is linewise this will
insert the text above the current line, like with `P`.
Does not replace characters!
The '.' register (last inserted text) is still inserted as
typed. {not in Vi}
+1 -1
View File
@@ -1,4 +1,4 @@
*pattern.txt* For Vim version 8.0. Last change: 2017 Mar 05
*pattern.txt* For Vim version 8.0. Last change: 2017 Mar 29
VIM REFERENCE MANUAL by Bram Moolenaar
+3 -25
View File
@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.0. Last change: 2017 Mar 29
*todo.txt* For Vim version 8.0. Last change: 2017 Apr 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -35,6 +35,8 @@ entered there will not be repeated below, unless there is extra information.
*known-bugs*
-------------------- Known bugs and current work -----------------------
Remove the Farsi code?
+channel:
- Try out background make plugin:
https://github.com/AndrewVos/vim-make-background
@@ -110,9 +112,6 @@ manager. Problem with Motif?
Memory leak in test97? The string is actually freed. Weird.
Patch for deleting the quickfix lists and a test for it. (Yegappan, 2017 Mar
21)
Add a toolbar in the terminal. Can be global, above all windows, or specific
for one window.
Use tb_set(winid, [{'text': 'stop', 'cb': callback, 'hi': 'Green'}])
@@ -122,16 +121,8 @@ Use tb_set(winid, [{'text': 'stop', 'cb': callback, 'hi': 'Green'}])
json_encode(): should convert to utf-8. (Nikolai Pavlov, 2016 Jan 23)
What if there is an invalid character?
Patch for broken foldtext. (Christian 2017 Mar 22, #1567, 2nd one)
Json string with trailing \u should be an error. (Lcd)
On MS-Windows with 'clipboard' set to "unnamed" this doesn't work to double
lines: :g/^/normal yyp On Unix it works OK. (Bryce Orgill, 2016 Nov 5)
Another example 2017 Mar 10.
Multi-byte bug: dv} splits char. (Urtica Dioica, 2017 Jan 9)
When session file has name in argument list but the buffer was deleted, the
buffer is not deleted when using the session file. (#1393)
Should add the buffer in hidden state.
@@ -139,10 +130,6 @@ Should add the buffer in hidden state.
When an item in the quickfix list has a file name that does not exist, behave
like the item was not a match for :cnext.
Patch to test regexp classes. (Dominique, 2017 Mar 13, #1560)
Do we need to adjust the implementation?
Make different classes that depend on the system and that don't.
Wrong diff highlighting with three files. (2016 Oct 20, #1186)
Also get E749 on exit.
Another example in #1309
@@ -150,21 +137,12 @@ Another example in #1309
Patch to change all use of &sw to shiftwidth(). (Tyru, 2017 Feb 19)
Wait until maintainers integrate it.
Patch to change mb_char2len() to utf_char2len(c) when known to use UTF.
(Dominique, 2017 Mar 21, #1582)
Completion for user-defined commands does not work if a few characters were
already typed. (Dominique, 2017 Jan 26)
When deleting a mark or register, leave a tombstone, so that it's also deleted
when writing viminfo (and the delete was the most recent action). #1339
Suggestion to improve pt-br spell checking. (Marcelo D Montu, 2016 Dec 15,
#1330)
Patch to Modernize GtkForm Implmentation. (Kazuki Kuriyama, 2017 Mar 26)
Any objections?
Error in test_startup_utf8 on Solaris. (Danek Duvall, 2016 Aug 17)
Completion for :!cmd shows each match twice. #1435
+9 -3
View File
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2017 Mar 27
" Last Change: 2017 Apr 15
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -310,9 +310,10 @@ au BufNewFile,BufRead *.bl setf blank
au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml
" Bazel (http://bazel.io)
autocmd BufRead,BufNewFile *.bzl,WORKSPACE setfiletype bzl
autocmd BufRead,BufNewFile *.bzl,WORKSPACE setf bzl
if has("fname_case")
autocmd BufRead,BufNewFile BUILD setfiletype bzl
" There is another check for BUILD further below.
autocmd BufRead,BufNewFile BUILD setf bzl
endif
" C or lpc
@@ -2602,6 +2603,11 @@ au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm')
" Bazaar version control
au BufNewFile,BufRead bzr_log.* setf bzr
" Bazel build file
if !has("fname_case")
au BufNewFile,BufRead BUILD setf bzl
endif
" BIND zone
au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone')
+14 -14
View File
@@ -274,7 +274,7 @@ function GetRIndent()
let nlnum = s:Get_prev_line(nlnum)
let nline = SanitizeRLine(getline(nlnum)) . nline
endwhile
if nline =~ '^\s*function\s*(' && indent(nlnum) == &sw
if nline =~ '^\s*function\s*(' && indent(nlnum) == shiftwidth()
return 0
endif
endif
@@ -285,7 +285,7 @@ function GetRIndent()
" line is an incomplete command:
if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' || line =~ '->$'
return indent(lnum) + &sw
return indent(lnum) + shiftwidth()
endif
" Deal with () and []
@@ -293,14 +293,14 @@ function GetRIndent()
let pb = s:Get_paren_balance(line, '(', ')')
if line =~ '^\s*{$' || line =~ '(\s*{' || (pb == 0 && (line =~ '{$' || line =~ '(\s*{$'))
return indent(lnum) + &sw
return indent(lnum) + shiftwidth()
endif
let s:curtabstop = repeat(' ', &tabstop)
if g:r_indent_align_args == 1
if pb > 0 && line =~ '{$'
return s:Get_last_paren_idx(line, '(', ')', pb) + &sw
return s:Get_last_paren_idx(line, '(', ')', pb) + shiftwidth()
endif
let bb = s:Get_paren_balance(line, '[', ']')
@@ -364,11 +364,11 @@ function GetRIndent()
if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum)
else
return indent(lnum) + &sw
return indent(lnum) + shiftwidth()
endif
else
if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum) - &sw
return indent(lnum) - shiftwidth()
endif
endif
endif
@@ -383,7 +383,7 @@ function GetRIndent()
let line = linepiece . line
endwhile
if line =~ '{$' && post_block == 0
return indent(lnum) + &sw
return indent(lnum) + shiftwidth()
endif
" Now we can do some tests again
@@ -393,19 +393,19 @@ function GetRIndent()
if post_block == 0
let newl = SanitizeRLine(line)
if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\<else$' || newl =~ '<-$'
return indent(lnum) + &sw
return indent(lnum) + shiftwidth()
endif
endif
endif
if cline =~ '^\s*else'
if line =~ '<-\s*if\s*()'
return indent(lnum) + &sw
return indent(lnum) + shiftwidth()
else
if line =~ '\<if\s*()'
return indent(lnum)
else
return indent(lnum) - &sw
return indent(lnum) - shiftwidth()
endif
endif
endif
@@ -474,12 +474,12 @@ function GetRIndent()
let ind = indent(lnum)
if g:r_indent_align_args == 0 && pb != 0
let ind += pb * &sw
let ind += pb * shiftwidth()
return ind
endif
if g:r_indent_align_args == 0 && bb != 0
let ind += bb * &sw
let ind += bb * shiftwidth()
return ind
endif
@@ -489,7 +489,7 @@ function GetRIndent()
let pind = 0
endif
if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0)
if ind == pind || (ind == (pind + shiftwidth()) && pline =~ '{$' && ppost_else == 0)
return ind
endif
@@ -509,7 +509,7 @@ function GetRIndent()
let pbb = s:Get_paren_balance(pline, '[', ']')
endwhile
let pind = indent(plnum)
if ind == (pind + &sw) && pline =~ '{$'
if ind == (pind + shiftwidth()) && pline =~ '{$'
return ind
endif
endwhile
+1 -1
View File
@@ -82,7 +82,7 @@ function GetRHelpIndent()
let closeb = strlen(line2) - strlen(line3)
let bb = openb - closeb
let ind = indent(lnum) + (bb * &sw)
let ind = indent(lnum) + (bb * shiftwidth())
if line =~ '^\s*}\s*$'
let ind = indent(lnum)
+10 -2
View File
@@ -1,6 +1,6 @@
" Vim script to work like "less"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2015 Nov 15
" Last Change: 2017 Mar 31
" Avoid loading this file twice, allow the user to define his own script.
if exists("loaded_less")
@@ -81,6 +81,10 @@ fun! s:Help()
echo "\n"
echo "/pattern Search for pattern ?pattern Search backward for pattern"
echo "n next pattern match N Previous pattern match"
if &foldmethod != "manual"
echo "\n"
echo "zR open all folds zm increase fold level"
endif
echo "\n"
echo ":n<Enter> Next file :p<Enter> Previous file"
echo "\n"
@@ -96,7 +100,11 @@ map <C-F> <Space>
map <PageDown> <Space>
map <kPageDown> <Space>
map <S-Down> <Space>
map z <Space>
" If 'foldmethod' was changed keep the "z" commands, e.g. "zR" to open all
" folds.
if &foldmethod == "manual"
map z <Space>
endif
map <Esc><Space> <Space>
fun! s:NextPage()
if line(".") == line("$")
+8 -6
View File
@@ -2,7 +2,7 @@
" Language: AutoHotkey script file
" Maintainer: Michael Wong
" https://github.com/mmikeww/autohotkey.vim
" Latest Revision: 2017-01-23
" Latest Revision: 2017-04-03
" Previous Maintainers: SungHyun Nam <goweol@gmail.com>
" Nikolai Weibull <now@bitwi.se>
@@ -106,6 +106,7 @@ syn keyword autohotkeyCommand
\ FormatTime IfInString IfNotInString Sort StringCaseSense StringGetPos
\ StringLeft StringRight StringLower StringUpper StringMid StringReplace
\ StringSplit StringTrimLeft StringTrimRight StringLen
\ StrSplit StrReplace Throw
\ Control ControlClick ControlFocus ControlGet ControlGetFocus
\ ControlGetPos ControlGetText ControlMove ControlSend ControlSendRaw
\ ControlSetText Menu PostMessage SendMessage SetControlDelay
@@ -119,17 +120,18 @@ syn keyword autohotkeyCommand
\ SetCapsLockState SetNumLockState SetScrollLockState
syn keyword autohotkeyFunction
\ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr
\ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr Func
\ DllCall VarSetCapacity WinActive WinExist IsLabel OnMessage
\ Abs Ceil Exp Floor Log Ln Mod Round Sqrt Sin Cos Tan ASin ACos ATan
\ FileExist GetKeyState NumGet NumPut StrGet StrPut RegisterCallback
\ IsFunc Trim LTrim RTrim IsObject Object Array FileOpen
\ ComObjActive ComObjArray ComObjConnect ComObjCreate ComObjGet
\ ComObjError ComObjFlags ComObjQuery ComObjType ComObjValue ComObject
\ Format Exception
syn keyword autohotkeyStatement
\ Break Continue Exit ExitApp Gosub Goto OnExit Pause Return
\ Suspend Reload
\ Suspend Reload new class extends
syn keyword autohotkeyRepeat
\ Loop
@@ -138,7 +140,7 @@ syn keyword autohotkeyConditional
\ IfExist IfNotExist If IfEqual IfLess IfGreater Else
\ IfWinExist IfWinNotExist IfWinActive IfWinNotActive
\ IfNotEqual IfLessOrEqual IfGreaterOrEqual
\ while until for in
\ while until for in try catch finally
syn match autohotkeyPreProcStart
\ nextgroup=
@@ -178,7 +180,7 @@ syn keyword autohotkeyPreProc
\ Warn
syn keyword autohotkeyMatchClass
\ ahk_group ahk_class ahk_id ahk_pid
\ ahk_group ahk_class ahk_id ahk_pid ahk_exe
syn match autohotkeyNumbers
\ display
@@ -217,7 +219,7 @@ syn match autohotkeyHotkey
\ contains=autohotkeyKey,
\ autohotkeyHotkeyDelimiter
\ display
\ '^.\{-}::'
\ '^\s*\S*\%( Up\)\?::'
syn match autohotkeyKey
\ contained
+145 -28
View File
@@ -5,10 +5,10 @@
" Tom Payne <tom@tompayne.org>
" Contributor: Johannes Ranke <jranke@uni-bremen.de>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Thu Aug 25, 2016 08:52PM
" Last Change: Sat Apr 08, 2017 07:01PM
" Filenames: *.R *.r *.Rhistory *.Rt
"
" NOTE: The highlighting of R functions is defined in
" NOTE: The highlighting of R functions might be defined in
" runtime files created by a filetype plugin, if installed.
"
" CONFIGURATION:
@@ -18,7 +18,7 @@
"
" ROxygen highlighting can be turned off by
"
" let r_hl_roxygen = 0
" let r_syntax_hl_roxygen = 0
"
" Some lines of code were borrowed from Zhuojun Chen.
@@ -26,13 +26,25 @@ if exists("b:current_syntax")
finish
endif
syn iskeyword @,48-57,_,.
if has("patch-7.4.1142")
syn iskeyword @,48-57,_,.
else
setlocal iskeyword=@,48-57,_,.
endif
" The variables g:r_hl_roxygen and g:r_syn_minlines were renamed on April 8, 2017.
if exists("g:r_hl_roxygen")
let g:r_syntax_hl_roxygen = g:r_hl_roxygen
endif
if exists("g:r_syn_minlines")
let g:r_syntax_minlines = g:r_syn_minlines
endif
if exists("g:r_syntax_folding") && g:r_syntax_folding
setlocal foldmethod=syntax
endif
if !exists("g:r_hl_roxygen")
let g:r_hl_roxygen = 1
if !exists("g:r_syntax_hl_roxygen")
let g:r_syntax_hl_roxygen = 1
endif
syn case match
@@ -42,19 +54,106 @@ syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):"
syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*"
" Roxygen
if g:r_hl_roxygen
syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend
syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey
syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained
if g:r_syntax_hl_roxygen
" A roxygen block can start at the beginning of a file (first version) and
" after a blank line (second version). It ends when a line that does not
" contain a roxygen comment. In the following comments, any line containing
" a roxygen comment marker (one or two hash signs # followed by a single
" quote ' and preceded only by whitespace) is called a roxygen line. A
" roxygen line containing only a roxygen comment marker, optionally followed
" by whitespace is called an empty roxygen line.
syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword
" First we match all roxygen blocks as containing only a title. In case an
" empty roxygen line ending the title or a tag is found, this will be
" overriden later by the definitions of rOBlock.
syn match rOTitleBlock "\%^\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag
syn match rOTitleBlock "^\s*\n\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag
syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)"
syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)"
" When a roxygen block has a title and additional content, the title
" consists of one or more roxygen lines (as little as possible are matched),
" followed either by an empty roxygen line
syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
" or by a roxygen tag (we match everything starting with @ but not @@ which is used as escape sequence for a literal @).
syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold
" If a block contains an @rdname, @describeIn tag, it may have paragraph breaks, but does not have a title
syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold
" A title as part of a block is always at the beginning of the block, i.e.
" either at the start of a file or after a completely empty line.
syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag
syn match rOTitleTag contained "@title"
syn match rOCommentKey "#\{1,2}'" contained
syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold
" rOTag list generated from the lists in
" https://github.com/klutometis/roxygen/R/rd.R and
" https://github.com/klutometis/roxygen/R/namespace.R
" using s/^ \([A-Za-z0-9]*\) = .*/ syn match rOTag contained "@\1"/
" Plus we need the @include tag
" rd.R
syn match rOTag contained "@aliases"
syn match rOTag contained "@author"
syn match rOTag contained "@backref"
syn match rOTag contained "@concept"
syn match rOTag contained "@describeIn"
syn match rOTag contained "@description"
syn match rOTag contained "@details"
syn match rOTag contained "@docType"
syn match rOTag contained "@encoding"
syn match rOTag contained "@evalRd"
syn match rOTag contained "@example"
syn match rOTag contained "@examples"
syn match rOTag contained "@family"
syn match rOTag contained "@field"
syn match rOTag contained "@format"
syn match rOTag contained "@inherit"
syn match rOTag contained "@inheritParams"
syn match rOTag contained "@inheritDotParams"
syn match rOTag contained "@inheritSection"
syn match rOTag contained "@keywords"
syn match rOTag contained "@method"
syn match rOTag contained "@name"
syn match rOTag contained "@md"
syn match rOTag contained "@noMd"
syn match rOTag contained "@noRd"
syn match rOTag contained "@note"
syn match rOTag contained "@param"
syn match rOTag contained "@rdname"
syn match rOTag contained "@rawRd"
syn match rOTag contained "@references"
syn match rOTag contained "@return"
syn match rOTag contained "@section"
syn match rOTag contained "@seealso"
syn match rOTag contained "@slot"
syn match rOTag contained "@source"
syn match rOTag contained "@template"
syn match rOTag contained "@templateVar"
syn match rOTag contained "@title"
syn match rOTag contained "@usage"
" namespace.R
syn match rOTag contained "@export"
syn match rOTag contained "@exportClass"
syn match rOTag contained "@exportMethod"
syn match rOTag contained "@exportPattern"
syn match rOTag contained "@import"
syn match rOTag contained "@importClassesFrom"
syn match rOTag contained "@importFrom"
syn match rOTag contained "@importMethodsFrom"
syn match rOTag contained "@rawNamespace"
syn match rOTag contained "@S3method"
syn match rOTag contained "@useDynLib"
" other
syn match rOTag contained "@include"
endif
@@ -168,12 +267,28 @@ syn match rBraceError "[)}]" contained
syn match rCurlyError "[)\]]" contained
syn match rParenError "[\]}]" contained
if !exists("g:R_hi_fun")
let g:R_hi_fun = 1
" Use Nvim-R to highlight functions dynamically if it is installed
if !exists("g:r_syntax_fun_pattern")
let s:ff = split(substitute(globpath(&rtp, "R/functions.vim"), "functions.vim", "", "g"), "\n")
if len(s:ff) > 0
let g:r_syntax_fun_pattern = 0
else
let g:r_syntax_fun_pattern = 1
endif
endif
if g:R_hi_fun
" Nvim-R:
runtime R/functions.vim
" Only use Nvim-R to highlight functions if they should not be highlighted
" according to a generic pattern
if g:r_syntax_fun_pattern == 1
syn match rFunction '[0-9a-zA-Z_\.]\+\s*\ze('
else
if !exists("g:R_hi_fun")
let g:R_hi_fun = 1
endif
if g:R_hi_fun
" Nvim-R:
runtime R/functions.vim
endif
endif
syn match rDollar display contained "\$"
@@ -205,8 +320,8 @@ if &filetype == "rhelp"
syn match rhSection "\\dontrun\>"
endif
if exists("r_syn_minlines")
exe "syn sync minlines=" . r_syn_minlines
if exists("r_syntax_minlines")
exe "syn sync minlines=" . r_syntax_minlines
else
syn sync minlines=40
endif
@@ -243,15 +358,17 @@ hi def link rStatement Statement
hi def link rString String
hi def link rStrError Error
hi def link rType Type
if g:r_hl_roxygen
hi def link rOKeyword Title
hi def link rOBlock Comment
if g:r_syntax_hl_roxygen
hi def link rOTitleTag Operator
hi def link rOTag Operator
hi def link rOTitleBlock Title
hi def link rOBlock Comment
hi def link rOBlockNoTitle Comment
hi def link rOTitle Title
hi def link rOCommentKey Comment
hi def link rOExamples SpecialComment
endif
let b:current_syntax="r"
" vim: ts=8 sw=2
+66 -28
View File
@@ -1,17 +1,26 @@
" markdown Text with R statements
" Language: markdown with R code chunks
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
" Last Change: Tue Jun 28, 2016 10:09AM
" Last Change: Sat Jan 28, 2017 10:06PM
"
" CONFIGURATION:
" To highlight chunk headers as R code, put in your vimrc:
" To highlight chunk headers as R code, put in your vimrc (e.g. .config/nvim/init.vim):
" let rmd_syn_hl_chunk = 1
"
" For highlighting pandoc extensions to markdown like citations and TeX and
" many other advanced features like folding of markdown sections, it is
" recommended to install the vim-pandoc filetype plugin as well as the
" vim-pandoc-syntax filetype plugin from https://github.com/vim-pandoc.
"
" TODO:
" - Provide highlighting for rmarkdown parameters in yaml header
if exists("b:current_syntax")
finish
endif
" load all of pandoc info
" load all of pandoc info, e.g. from
" https://github.com/vim-pandoc/vim-pandoc-syntax
runtime syntax/pandoc.vim
if exists("b:current_syntax")
let rmdIsPandoc = 1
@@ -22,28 +31,54 @@ else
if exists("b:current_syntax")
unlet b:current_syntax
endif
" load all of the yaml syntax highlighting rules into @yaml
syntax include @yaml syntax/yaml.vim
if exists("b:current_syntax")
unlet b:current_syntax
endif
" highlight yaml block commonly used for front matter
syntax region rmdYamlBlock matchgroup=rmdYamlBlockDelim start="^---" matchgroup=rmdYamlBlockDelim end="^---" contains=@yaml keepend fold
endif
" load all of the r syntax highlighting rules into @R
syntax include @R syntax/r.vim
if exists("b:current_syntax")
unlet b:current_syntax
endif
if exists("g:rmd_syn_hl_chunk")
" highlight R code inside chunk header
syntax match rmdChunkDelim "^[ \t]*```{r" contained
syntax match rmdChunkDelim "}$" contained
if !exists("g:rmd_syn_langs")
let g:rmd_syn_langs = ["r"]
else
syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained
let s:hasr = 0
for s:lng in g:rmd_syn_langs
if s:lng == "r"
let s:hasr = 1
endif
endfor
if s:hasr == 0
let g:rmd_syn_langs += ["r"]
endif
endif
syntax match rmdChunkDelim "^[ \t]*```$" contained
syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold
for s:lng in g:rmd_syn_langs
exe 'syntax include @' . toupper(s:lng) . ' syntax/'. s:lng . '.vim'
if exists("b:current_syntax")
unlet b:current_syntax
endif
exe 'syntax region rmd' . toupper(s:lng) . 'Chunk start="^[ \t]*``` *{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\).*}$" end="^[ \t]*```$" contains=@' . toupper(s:lng) . ',rmd' . toupper(s:lng) . 'ChunkDelim keepend fold'
if exists("g:rmd_syn_hl_chunk") && s:lng == "r"
" highlight R code inside chunk header
syntax match rmdRChunkDelim "^[ \t]*```{r" contained
syntax match rmdRChunkDelim "}$" contained
else
exe 'syntax match rmd' . toupper(s:lng) . 'ChunkDelim "^[ \t]*```{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\).*}$" contained'
endif
exe 'syntax match rmd' . toupper(s:lng) . 'ChunkDelim "^[ \t]*```$" contained'
endfor
" also match and syntax highlight in-line R code
syntax match rmdEndInline "`" contained
syntax match rmdBeginInline "`r " contained
syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndInline keepend
syntax region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@R containedin=pandocLaTeXRegion,yamlFlowString keepend
" I was not able to highlight rmdrInline inside a pandocLaTeXCommand, although
" highlighting works within pandocLaTeXRegion and yamlFlowString.
syntax cluster texMathZoneGroup add=rmdrInline
" match slidify special marker
syntax match rmdSlidifySpecial "\*\*\*"
@@ -56,8 +91,6 @@ if rmdIsPandoc == 0
if exists("b:current_syntax")
unlet b:current_syntax
endif
" Extend cluster
syn cluster texMathZoneGroup add=rmdrInline
" Inline
syntax match rmdLaTeXInlDelim "\$"
syntax match rmdLaTeXInlDelim "\\\$"
@@ -65,19 +98,24 @@ if rmdIsPandoc == 0
" Region
syntax match rmdLaTeXRegDelim "\$\$" contained
syntax match rmdLaTeXRegDelim "\$\$latex$" contained
syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
syntax match rmdLaTeXSt "\\[a-zA-Z]\+"
syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXRegDelim keepend
syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXRegDelim keepend
hi def link rmdBlockQuote Comment
hi def link rmdLaTeXSt Statement
hi def link rmdLaTeXInlDelim Special
hi def link rmdLaTeXRegDelim Special
endif
syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r"
for s:lng in g:rmd_syn_langs
exe 'syn sync match rmd' . toupper(s:lng) . 'SyncChunk grouphere rmd' . toupper(s:lng) . 'Chunk /^[ \t]*``` *{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\)/'
endfor
hi def link rmdChunkDelim Special
hi def link rmdBeginInline Special
hi def link rmdEndInline Special
hi def link rmdBlockQuote Comment
hi def link rmdYamlBlockDelim Delim
for s:lng in g:rmd_syn_langs
exe 'hi def link rmd' . toupper(s:lng) . 'ChunkDelim Special'
endfor
hi def link rmdInlineDelim Special
hi def link rmdSlidifySpecial Special
let b:current_syntax = "rmd"
+1 -1
View File
@@ -1255,7 +1255,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>130</string>
<string>131</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
+2
View File
@@ -31,6 +31,7 @@
BOOL antialias;
BOOL ligatures;
BOOL thinStrokes;
BOOL drawPending;
NSMutableArray *drawData;
MMTextViewHelper *helper;
@@ -96,6 +97,7 @@
//
// NSTextView methods
//
- (void)setFrameSize:(NSSize)newSize;
- (void)keyDown:(NSEvent *)event;
- (void)insertText:(id)string;
- (void)doCommandBySelector:(SEL)selector;
+12 -5
View File
@@ -446,6 +446,14 @@ defaultAdvanceForFont(NSFont *font)
return YES;
}
- (void)setFrameSize:(NSSize)newSize {
if (!drawPending && !NSEqualSizes(newSize, self.frame.size) && drawData.count == 0) {
[NSAnimationContext beginGrouping];
drawPending = YES;
}
[super setFrameSize:newSize];
}
- (void)keyDown:(NSEvent *)event
{
[helper keyDown:event];
@@ -650,11 +658,10 @@ defaultAdvanceForFont(NSFont *font)
} else {
[drawData addObject:data];
[self setNeedsDisplay:YES];
// NOTE: During resizing, Cocoa only sends draw messages before Vim's rows
// and columns are changed (due to ipc delays). Force a redraw here.
if ([self inLiveResize])
[self display];
}
if (drawPending) {
[NSAnimationContext endGrouping];
drawPending = NO;
}
}
+7 -5
View File
@@ -110,8 +110,8 @@ enum {
// Each fade goes in and then out, so the fade hardware must be reserved accordingly and the
// actual fade time can't exceed half the allowable reservation time... plus some slack to
// prevent visual artifacts caused by defaulting on the fade hardware lease.
fadeTime = MIN(fadeTime, 0.45 * kCGMaxDisplayReservationInterval);
fadeReservationTime = 2.0 * fadeTime + 0.1;
fadeTime = MIN(fadeTime, 0.5 * (kCGMaxDisplayReservationInterval - 1));
fadeReservationTime = 2.0 * fadeTime + 1;
return self;
}
@@ -218,9 +218,11 @@ enum {
// fade back in
if (didBlend) {
CGDisplayFade(token, fadeTime, kCGDisplayBlendSolidColor,
kCGDisplayBlendNormal, .0, .0, .0, false);
CGReleaseDisplayFadeReservation(token);
[NSAnimationContext currentContext].completionHandler = ^{
CGDisplayFade(token, fadeTime, kCGDisplayBlendSolidColor,
kCGDisplayBlendNormal, .0, .0, .0, false);
CGReleaseDisplayFadeReservation(token);
};
}
state = InFullScreen;
+3 -9
View File
@@ -554,15 +554,9 @@ static BOOL isUnsafeMessage(int msgid);
{
if (OpenWindowMsgID == msgid) {
[windowController openWindow];
// HACK: Delay actually presenting the window onscreen until after
// processing the queue since it contains drawing commands that need to
// be issued before presentation; otherwise the window may flash white
// just as it opens.
if (!isPreloading)
[windowController performSelector:@selector(presentWindow:)
withObject:nil
afterDelay:0];
if (!isPreloading) {
[windowController presentWindow:nil];
}
} else if (BatchDrawMsgID == msgid) {
[[[windowController vimView] textView] performBatchDrawWithData:data];
} else if (SelectTabMsgID == msgid) {
+1 -1
View File
@@ -909,7 +909,7 @@ enum {
"%dx%d (%s)", cols, rows, constrained[1], constrained[0],
MessageStrings[msgid]);
[vimController sendMessage:msgid data:data];
[vimController sendMessageNow:msgid data:data timeout:1];
// We only want to set the window title if this resize came from
// a live-resize, not (for example) setting 'columns' or 'lines'.
+1
View File
@@ -40,6 +40,7 @@
int userCols;
NSPoint userTopLeft;
NSPoint defaultTopLeft;
NSSize desiredWindowSize;
NSToolbar *toolbar;
BOOL resizingDueToMove;
int blurRadius;
+10 -35
View File
@@ -594,11 +594,12 @@
// TODO: What if the resize message fails to make it back?
if (!didMaximize) {
NSSize originalSize = [vimView frame].size;
NSSize contentSize = [vimView desiredSize];
contentSize = [self constrainContentSizeToScreenSize:contentSize];
int rows = 0, cols = 0;
contentSize = [vimView constrainRows:&rows columns:&cols
toSize:contentSize];
NSSize contentSize = [vimView constrainRows:&rows columns:&cols
toSize:
fullScreenWindow ? [fullScreenWindow frame].size :
fullScreenEnabled ? desiredWindowSize :
[self constrainContentSizeToScreenSize:[vimView desiredSize]]];
[vimView setFrameSize:contentSize];
if (fullScreenWindow) {
@@ -697,37 +698,6 @@
NSConnection *connection = [(NSDistantObject*)proxy connectionForProxy];
[connection removeRequestMode:NSEventTrackingRunLoopMode];
// NOTE: During live resize messages from MacVim to Vim are often dropped
// (because too many messages are sent at once). This may lead to
// inconsistent states between Vim and MacVim; to avoid this we send a
// synchronous resize message to Vim now (this is not fool-proof, but it
// does seem to work quite well).
// Do NOT send a SetTextDimensionsMsgID message (as opposed to
// LiveResizeMsgID) since then the view is constrained to not be larger
// than the screen the window mostly occupies; this makes it impossible to
// resize the window across multiple screens.
int constrained[2];
NSSize textViewSize = [[vimView textView] frame].size;
[[vimView textView] constrainRows:&constrained[0] columns:&constrained[1]
toSize:textViewSize];
ASLogDebug(@"End of live resize, notify Vim that text dimensions are %dx%d",
constrained[1], constrained[0]);
NSData *data = [NSData dataWithBytes:constrained length:2*sizeof(int)];
BOOL sendOk = [vimController sendMessageNow:LiveResizeMsgID
data:data
timeout:.5];
if (!sendOk) {
// Sending of synchronous message failed. Force the window size to
// match the last dimensions received from Vim, otherwise we end up
// with inconsistent states.
[self resizeWindowToFitContentSize:[vimView desiredSize]
keepOnScreen:NO];
}
// If we saved the original title while resizing, restore it.
if (lastSetTitle != nil) {
[decoratedWindow setTitle:lastSetTitle];
@@ -1034,6 +1004,11 @@
[vimController sendMessage:SetWindowPositionMsgID data:data];
}
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize {
desiredWindowSize = frameSize;
return frameSize;
}
- (void)windowDidResize:(id)sender
{
if (resizingDueToMove) {
+2 -1
View File
@@ -2139,10 +2139,10 @@ test_arglist \
test_delete \
test_diffmode \
test_digraph \
test_functions \
test_display \
test_edit \
test_ex_undo \
test_ex_z \
test_execute_func \
test_expand \
test_expand_dllpath \
@@ -2159,6 +2159,7 @@ test_arglist \
test_fnameescape \
test_fnamemodify \
test_fold \
test_functions \
test_ga \
test_gf \
test_glob2regpat \
+7 -2
View File
@@ -2592,9 +2592,14 @@ may_invoke_callback(channel_T *channel, ch_part_T part)
if (nl == NULL)
{
/* Flush remaining message that is missing a NL. */
buf = vim_realloc(buf, node->rq_buflen + 1);
if (buf == NULL)
char_u *new_buf;
new_buf = vim_realloc(buf, node->rq_buflen + 1);
if (new_buf == NULL)
/* This might fail over and over again, should the message
* be dropped? */
return FALSE;
buf = new_buf;
node->rq_buffer = buf;
nl = buf + node->rq_buflen++;
*nl = NUL;
+7 -3
View File
@@ -960,7 +960,7 @@ vim_isfilec_or_wc(int c)
}
/*
* return TRUE if 'c' is a printable character
* Return TRUE if 'c' is a printable character.
* Assume characters above 0x100 are printable (multi-byte), except for
* Unicode.
*/
@@ -1717,7 +1717,7 @@ vim_toupper(int c)
{
if (c <= '@')
return c;
if (c >= 0x80)
if (c >= 0x80 || !(cmp_flags & CMP_KEEPASCII))
{
if (enc_utf8)
return utf_toupper(c);
@@ -1733,6 +1733,8 @@ vim_toupper(int c)
if (enc_latin1like)
return latin1upper[c];
}
if (c < 0x80 && (cmp_flags & CMP_KEEPASCII))
return TOUPPER_ASC(c);
return TOUPPER_LOC(c);
}
@@ -1741,7 +1743,7 @@ vim_tolower(int c)
{
if (c <= '@')
return c;
if (c >= 0x80)
if (c >= 0x80 || !(cmp_flags & CMP_KEEPASCII))
{
if (enc_utf8)
return utf_tolower(c);
@@ -1757,6 +1759,8 @@ vim_tolower(int c)
if (enc_latin1like)
return latin1lower[c];
}
if (c < 0x80 && (cmp_flags & CMP_KEEPASCII))
return TOLOWER_ASC(c);
return TOLOWER_LOC(c);
}
#endif
+27 -13
View File
@@ -4770,7 +4770,6 @@ ins_compl_next(
int in_compl_func) /* called from complete_check() */
{
int num_matches = -1;
int i;
int todo = count;
compl_T *found_compl = NULL;
int found_end = FALSE;
@@ -4962,15 +4961,30 @@ ins_compl_next(
*/
if (compl_shown_match->cp_fname != NULL)
{
STRCPY(IObuff, "match in file ");
i = (vim_strsize(compl_shown_match->cp_fname) + 16) - sc_col;
if (i <= 0)
i = 0;
else
STRCAT(IObuff, "<");
STRCAT(IObuff, compl_shown_match->cp_fname + i);
msg(IObuff);
redraw_cmdline = FALSE; /* don't overwrite! */
char *lead = _("match in file");
int space = sc_col - vim_strsize((char_u *)lead) - 2;
char_u *s;
char_u *e;
if (space > 0)
{
/* We need the tail that fits. With double-byte encoding going
* back from the end is very slow, thus go from the start and keep
* the text that fits in "space" between "s" and "e". */
for (s = e = compl_shown_match->cp_fname; *e != NUL; MB_PTR_ADV(e))
{
space -= ptr2cells(e);
while (space < 0)
{
space += ptr2cells(s);
MB_PTR_ADV(s);
}
}
vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead,
s > compl_shown_match->cp_fname ? "<" : "", s);
msg(IObuff);
redraw_cmdline = FALSE; /* don't overwrite! */
}
}
return num_matches;
@@ -9017,7 +9031,7 @@ ins_bs(
#endif
/*
* delete newline!
* Delete newline!
*/
if (curwin->w_cursor.col == 0)
{
@@ -9032,7 +9046,7 @@ ins_bs(
(linenr_T)(curwin->w_cursor.lnum + 1)) == FAIL)
return FALSE;
--Insstart.lnum;
Insstart.col = MAXCOL;
Insstart.col = (colnr_T)STRLEN(ml_get(Insstart.lnum));
}
/*
* In replace mode:
@@ -9543,7 +9557,7 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
#endif
buf[idx++] = c;
buf[idx] = NUL;
if (end != NUL && STRNCMP(buf, end, idx) == 0)
if (end != NULL && STRNCMP(buf, end, idx) == 0)
{
if (end[idx] == NUL)
break; /* Found the end of paste code. */
+5 -3
View File
@@ -6120,13 +6120,16 @@ var2fpos(
if (name[1] == '0') /* "w0": first visible line */
{
update_topline();
pos.lnum = curwin->w_topline;
/* In silent Ex mode topline is zero, but that's not a valid line
* number; use one instead. */
pos.lnum = curwin->w_topline > 0 ? curwin->w_topline : 1;
return &pos;
}
else if (name[1] == '$') /* "w$": last visible line */
{
validate_botline();
pos.lnum = curwin->w_botline - 1;
/* In silent Ex mode botline is zero, return zero then. */
pos.lnum = curwin->w_botline > 0 ? curwin->w_botline - 1 : 0;
return &pos;
}
}
@@ -8325,7 +8328,6 @@ ex_execute(exarg_T *eap)
* follows is displayed on a new line when scrolling back at the
* more prompt. */
msg_sb_eol();
msg_start();
}
if (eap->cmdidx == CMD_echomsg)
+37 -18
View File
@@ -5248,24 +5248,6 @@ f_getwininfo(typval_T *argvars, typval_T *rettv)
#endif
}
/*
* "getwinposx()" function
*/
static void
f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->vval.v_number = -1;
#ifdef FEAT_GUI
if (gui.in_use)
{
int x, y;
if (gui_mch_get_winpos(&x, &y) == OK)
rettv->vval.v_number = x;
}
#endif
}
/*
* "win_findbuf()" function
*/
@@ -5313,6 +5295,33 @@ f_win_id2win(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = win_id2win(argvars);
}
/*
* "getwinposx()" function
*/
static void
f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->vval.v_number = -1;
#ifdef FEAT_GUI
if (gui.in_use)
{
int x, y;
if (gui_mch_get_winpos(&x, &y) == OK)
rettv->vval.v_number = x;
return;
}
#endif
#if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)
{
int x, y;
if (term_get_winpos(&x, &y) == OK)
rettv->vval.v_number = x;
}
#endif
}
/*
* "getwinposy()" function
*/
@@ -5327,6 +5336,15 @@ f_getwinposy(typval_T *argvars UNUSED, typval_T *rettv)
if (gui_mch_get_winpos(&x, &y) == OK)
rettv->vval.v_number = y;
return;
}
#endif
#if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)
{
int x, y;
if (term_get_winpos(&x, &y) == OK)
rettv->vval.v_number = y;
}
#endif
}
@@ -7718,6 +7736,7 @@ static int mkdir_recurse(char_u *dir, int prot);
/*
* Create the directory in which "dir" is located, and higher levels when
* needed.
* Return OK or FAIL.
*/
static int
mkdir_recurse(char_u *dir, int prot)
+7 -2
View File
@@ -4564,7 +4564,7 @@ ex_change(exarg_T *eap)
ex_z(exarg_T *eap)
{
char_u *x;
int bigness;
long bigness;
char_u *kind;
int minus = 0;
linenr_T start, end, curs, i;
@@ -4601,7 +4601,12 @@ ex_z(exarg_T *eap)
}
else
{
bigness = atoi((char *)x);
bigness = atol((char *)x);
/* bigness could be < 0 if atol(x) overflows. */
if (bigness > 2 * curbuf->b_ml.ml_line_count || bigness < 0)
bigness = 2 * curbuf->b_ml.ml_line_count;
p_window = bigness;
if (*kind == '=')
bigness += 2;
+1 -1
View File
@@ -1629,7 +1629,7 @@ EX(CMD_wincmd, "wincmd", ex_wincmd,
NEEDARG|WORD1|RANGE|NOTADR,
ADDR_WINDOWS),
EX(CMD_windo, "windo", ex_listdo,
BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
ADDR_WINDOWS),
EX(CMD_winpos, "winpos", ex_winpos,
EXTRA|TRLBAR|CMDWIN,
+6 -6
View File
@@ -127,7 +127,7 @@ static void clear_hist_entry(histentry_T *hisptr);
#endif
#ifdef FEAT_CMDWIN
static int ex_window(void);
static int open_cmdwin(void);
#endif
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
@@ -773,7 +773,7 @@ getcmdline(
/*
* Open a window to edit the command line (and history).
*/
c = ex_window();
c = open_cmdwin();
some_key_typed = TRUE;
}
}
@@ -1292,7 +1292,7 @@ getcmdline(
goto cmdline_not_changed;
case K_IGNORE:
/* Ignore mouse event or ex_window() result. */
/* Ignore mouse event or open_cmdwin() result. */
goto cmdline_not_changed;
#ifdef FEAT_GUI_W32
@@ -4158,7 +4158,7 @@ showmatches(expand_T *xp, int wildmenu UNUSED)
got_int = FALSE; /* only int. the completion, not the cmd line */
#ifdef FEAT_WILDMENU
else if (wildmenu)
win_redr_status_matches(xp, num_files, files_found, 0, showtail);
win_redr_status_matches(xp, num_files, files_found, -1, showtail);
#endif
else
{
@@ -6810,7 +6810,7 @@ cmd_gchar(int offset)
* K_IGNORE if editing continues
*/
static int
ex_window(void)
open_cmdwin(void)
{
struct cmdline_info save_ccline;
bufref_T old_curbuf;
@@ -6855,6 +6855,7 @@ ex_window(void)
# endif
/* don't use a new tab page */
cmdmod.tab = 0;
cmdmod.noswapfile = 1;
/* Create a window for the command-line buffer. */
if (win_split((int)p_cwh, WSP_BOT) == FAIL)
@@ -6871,7 +6872,6 @@ ex_window(void)
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
(void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE);
set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
curbuf->b_p_ma = TRUE;
#ifdef FEAT_FOLDING
curwin->w_p_fen = FALSE;
+1 -1
View File
@@ -1695,7 +1695,7 @@ conv_to_pvim(void)
ptr[i] = toF_leading(ptr[i]);
++i;
while (canF_Rjoin(ptr[i]) && i < llen)
while (i < llen && canF_Rjoin(ptr[i]))
{
ptr[i] = toF_Rjoin(ptr[i]);
if (F_isterm(ptr[i]) || !F_isalpha(ptr[i]))
+3 -2
View File
@@ -9354,6 +9354,7 @@ apply_autocmds_group(
proftime_T wait_time;
#endif
int did_save_redobuff = FALSE;
save_redo_T save_redo;
/*
* Quickly return if there are no autocommands for this event or
@@ -9559,7 +9560,7 @@ apply_autocmds_group(
if (!ins_compl_active())
#endif
{
saveRedobuff();
saveRedobuff(&save_redo);
did_save_redobuff = TRUE;
}
did_filetype = keep_filetype;
@@ -9662,7 +9663,7 @@ apply_autocmds_group(
{
restore_search_patterns();
if (did_save_redobuff)
restoreRedobuff();
restoreRedobuff(&save_redo);
did_filetype = FALSE;
while (au_pending_free_buf != NULL)
{
+29 -31
View File
@@ -42,10 +42,6 @@
static buffheader_T redobuff = {{NULL, {NUL}}, NULL, 0, 0};
static buffheader_T old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
static buffheader_T save_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
static buffheader_T save_old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
#endif
static buffheader_T recordbuff = {{NULL, {NUL}}, NULL, 0, 0};
static int typeahead_char = 0; /* typeahead char that's not flushed */
@@ -521,27 +517,22 @@ CancelRedo(void)
* Save redobuff and old_redobuff to save_redobuff and save_old_redobuff.
* Used before executing autocommands and user functions.
*/
static int save_level = 0;
void
saveRedobuff(void)
saveRedobuff(save_redo_T *save_redo)
{
char_u *s;
if (save_level++ == 0)
{
save_redobuff = redobuff;
redobuff.bh_first.b_next = NULL;
save_old_redobuff = old_redobuff;
old_redobuff.bh_first.b_next = NULL;
save_redo->sr_redobuff = redobuff;
redobuff.bh_first.b_next = NULL;
save_redo->sr_old_redobuff = old_redobuff;
old_redobuff.bh_first.b_next = NULL;
/* Make a copy, so that ":normal ." in a function works. */
s = get_buffcont(&save_redobuff, FALSE);
if (s != NULL)
{
add_buff(&redobuff, s, -1L);
vim_free(s);
}
/* Make a copy, so that ":normal ." in a function works. */
s = get_buffcont(&save_redo->sr_redobuff, FALSE);
if (s != NULL)
{
add_buff(&redobuff, s, -1L);
vim_free(s);
}
}
@@ -550,15 +541,12 @@ saveRedobuff(void)
* Used after executing autocommands and user functions.
*/
void
restoreRedobuff(void)
restoreRedobuff(save_redo_T *save_redo)
{
if (--save_level == 0)
{
free_buff(&redobuff);
redobuff = save_redobuff;
free_buff(&old_redobuff);
old_redobuff = save_old_redobuff;
}
free_buff(&redobuff);
redobuff = save_redo->sr_redobuff;
free_buff(&old_redobuff);
old_redobuff = save_redo->sr_old_redobuff;
}
#endif
@@ -932,7 +920,7 @@ init_typebuf(void)
typebuf.tb_noremap = noremapbuf_init;
typebuf.tb_buflen = TYPELEN_INIT;
typebuf.tb_len = 0;
typebuf.tb_off = 0;
typebuf.tb_off = MAXMAPLEN + 4;
typebuf.tb_change_cnt = 1;
}
}
@@ -986,11 +974,21 @@ ins_typebuf(
typebuf.tb_off -= addlen;
mch_memmove(typebuf.tb_buf + typebuf.tb_off, str, (size_t)addlen);
}
else if (typebuf.tb_len == 0 && typebuf.tb_buflen
>= addlen + 3 * (MAXMAPLEN + 4))
{
/*
* Buffer is empty and string fits in the existing buffer.
* Leave some space before and after, if possible.
*/
typebuf.tb_off = (typebuf.tb_buflen - addlen - 3 * (MAXMAPLEN + 4)) / 2;
mch_memmove(typebuf.tb_buf + typebuf.tb_off, str, (size_t)addlen);
}
else
{
/*
* Need to allocate a new buffer.
* In typebuf.tb_buf there must always be room for 3 * MAXMAPLEN + 4
* In typebuf.tb_buf there must always be room for 3 * (MAXMAPLEN + 4)
* characters. We add some extra room to avoid having to allocate too
* often.
*/
@@ -1303,7 +1301,7 @@ alloc_typebuf(void)
return FAIL;
}
typebuf.tb_buflen = TYPELEN_INIT;
typebuf.tb_off = 0;
typebuf.tb_off = MAXMAPLEN + 4; /* can insert without realloc */
typebuf.tb_len = 0;
typebuf.tb_maplen = 0;
typebuf.tb_silent = 0;
-31
View File
@@ -92,11 +92,6 @@ static void gtk_form_position_child(GtkForm *form,
gboolean force_allocate);
static void gtk_form_position_children(GtkForm *form);
#if !GTK_CHECK_VERSION(3,16,0)
static void gtk_form_set_static_gravity(GdkWindow *window,
gboolean use_static);
#endif
static void gtk_form_send_configure(GtkForm *form);
static void gtk_form_child_map(GtkWidget *widget, gpointer user_data);
@@ -370,10 +365,6 @@ gtk_form_realize(GtkWidget *widget)
#endif
gdk_window_set_user_data(form->bin_window, widget);
#if !GTK_CHECK_VERSION(3,16,0)
gtk_form_set_static_gravity(form->bin_window, TRUE);
#endif
#if GTK_CHECK_VERSION(3,0,0)
{
GtkStyleContext * const sctx = gtk_widget_get_style_context(widget);
@@ -845,9 +836,6 @@ gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child)
#endif
gtk_widget_set_parent_window(child->widget, child->window);
#if !GTK_CHECK_VERSION(3,16,0)
gtk_form_set_static_gravity(child->window, TRUE);
#endif
/*
* Install signal handlers to map/unmap child->window
* alongside with the actual widget.
@@ -879,15 +867,6 @@ gtk_form_realize_child(GtkForm *form, GtkFormChild *child)
{
gtk_form_attach_child_window(form, child);
gtk_widget_realize(child->widget);
#if !GTK_CHECK_VERSION(3,16,0)
if (child->window == NULL) /* might be already set, see above */
# if GTK_CHECK_VERSION(3,0,0)
gtk_form_set_static_gravity(gtk_widget_get_window(child->widget), TRUE);
# else
gtk_form_set_static_gravity(child->widget->window, TRUE);
# endif
#endif
}
static void
@@ -999,16 +978,6 @@ gtk_form_position_children(GtkForm *form)
gtk_form_position_child(form, tmp_list->data, FALSE);
}
#if !GTK_CHECK_VERSION(3,16,0)
static void
gtk_form_set_static_gravity(GdkWindow *window, gboolean use_static)
{
/* We don't check if static gravity is actually supported, because it
* results in an annoying assertion error message. */
gdk_window_set_static_gravities(window, use_static);
}
#endif /* !GTK_CHECK_VERSION(3,16,0) */
void
gtk_form_move_resize(GtkForm *form, GtkWidget *widget,
gint x, gint y, gint w, gint h)
+18 -9
View File
@@ -89,15 +89,16 @@ static char *(main_errors[]) =
};
#ifndef PROTO /* don't want a prototype for main() */
/* Various parameters passed between main() and other functions. */
static mparm_T params;
#ifndef NO_VIM_MAIN /* skip this for unittests */
static char_u *start_dir = NULL; /* current working dir on startup */
static int has_dash_c_arg = FALSE;
/* Various parameters passed between main() and other functions. */
static mparm_T params;
int
# ifdef VIMDLL
_export
@@ -688,12 +689,6 @@ vim_main2(void)
starttermcap(); /* start termcap if not done by wait_return() */
TIME_MSG("start termcap");
#if defined(FEAT_TERMRESPONSE)
# if defined(FEAT_MBYTE)
may_req_ambiguous_char_width();
# endif
may_req_bg_color();
#endif
#ifdef FEAT_MOUSE
setmouse(); /* may start using the mouse */
@@ -850,6 +845,11 @@ vim_main2(void)
/* Requesting the termresponse is postponed until here, so that a "-c q"
* argument doesn't make it appear in the shell Vim was started from. */
may_req_termresponse();
# if defined(FEAT_MBYTE)
may_req_ambiguous_char_width();
# endif
may_req_bg_color();
#endif
/* start in insert mode */
@@ -1075,6 +1075,15 @@ common_init(mparm_T *paramp)
#endif
}
/*
* Return TRUE when the --not-a-term argument was found.
*/
int
is_not_a_term()
{
return params.not_a_term;
}
/*
* Main loop: Execute Normal mode commands until exiting Vim.
* Also used to handle commands in the command-line window, until the window
-2
View File
@@ -96,8 +96,6 @@ test_trunc_string(void)
int
main(int argc, char **argv)
{
mparm_T params;
vim_memset(&params, 0, sizeof(params));
params.argc = argc;
params.argv = argv;
+1 -1
View File
@@ -2129,7 +2129,7 @@ ga_concat(garray_T *gap, char_u *s)
{
int len;
if (s == NULL)
if (s == NULL || *s == NUL)
return;
len = (int)STRLEN(s);
if (ga_grow(gap, len) == OK)
+2 -1
View File
@@ -3271,6 +3271,7 @@ static struct vimoption options[] =
p_term("t_vi", T_VI)
p_term("t_vs", T_VS)
p_term("t_WP", T_CWP)
p_term("t_GP", T_CGP)
p_term("t_WS", T_CWS)
p_term("t_xn", T_XN)
p_term("t_xs", T_XS)
@@ -11285,7 +11286,7 @@ buf_copy_options(buf_T *buf, int flags)
buf->b_p_ml = p_ml;
buf->b_p_ml_nobin = p_ml_nobin;
buf->b_p_inf = p_inf;
buf->b_p_swf = p_swf;
buf->b_p_swf = cmdmod.noswapfile ? FALSE : p_swf;
#ifdef FEAT_INS_EXPAND
buf->b_p_cpt = vim_strsave(p_cpt);
#endif
+8 -2
View File
@@ -6028,6 +6028,7 @@ mch_expand_wildcards(
{
int i;
size_t len;
long llen;
char_u *p;
int dir;
@@ -6314,9 +6315,13 @@ mch_expand_wildcards(
goto notfound;
}
fseek(fd, 0L, SEEK_END);
len = ftell(fd); /* get size of temp file */
llen = ftell(fd); /* get size of temp file */
fseek(fd, 0L, SEEK_SET);
buffer = alloc(len + 1);
if (llen < 0)
/* just in case ftell() would fail */
buffer = NULL;
else
buffer = alloc(llen + 1);
if (buffer == NULL)
{
/* out of memory */
@@ -6325,6 +6330,7 @@ mch_expand_wildcards(
fclose(fd);
return FAIL;
}
len = llen;
i = fread((char *)buffer, 1, len, fd);
fclose(fd);
mch_remove(tempname);
+2 -2
View File
@@ -8,8 +8,8 @@ void typeahead_noflush(int c);
void flush_buffers(int flush_typeahead);
void ResetRedobuff(void);
void CancelRedo(void);
void saveRedobuff(void);
void restoreRedobuff(void);
void saveRedobuff(save_redo_T *save_redo);
void restoreRedobuff(save_redo_T *save_redo);
void AppendToRedobuff(char_u *s);
void AppendToRedobuffLit(char_u *str, int len);
void AppendCharToRedobuff(int c);
+1
View File
@@ -1,6 +1,7 @@
/* main.c */
int vim_main2(void);
void common_init(mparm_T *paramp);
int is_not_a_term(void);
void main_loop(int cmdwin, int noexmode);
void getout_preserve_modified(int exitval);
void getout(int exitval);
+1
View File
@@ -22,6 +22,7 @@ void term_cursor_right(int i);
void term_append_lines(int line_count);
void term_delete_lines(int line_count);
void term_set_winpos(int x, int y);
int term_get_winpos(int *x, int *y);
void term_set_winsize(int width, int height);
void term_fg_color(int n);
void term_bg_color(int n);
+54
View File
@@ -2750,6 +2750,7 @@ qf_free(qf_info_T *qi, int idx)
vim_free(qi->qf_lists[idx].qf_title);
qi->qf_lists[idx].qf_title = NULL;
qi->qf_lists[idx].qf_index = 0;
qi->qf_lists[idx].qf_last = NULL;
qf_clean_dir_stack(&qi->qf_dir_stack);
qi->qf_directory = NULL;
@@ -4866,9 +4867,50 @@ qf_set_properties(qf_info_T *qi, dict_T *what, int action)
return retval;
}
/*
* Find the non-location list window with the specified location list.
*/
static win_T *
find_win_with_ll(qf_info_T *qi)
{
win_T *wp = NULL;
FOR_ALL_WINDOWS(wp)
if ((wp->w_llist == qi) && !bt_quickfix(wp->w_buffer))
return wp;
return NULL;
}
/*
* Free the entire quickfix/location list stack.
* If the quickfix/location list window is open, then clear it.
*/
static void
qf_free_stack(win_T *wp, qf_info_T *qi)
{
win_T *qfwin = qf_find_win(qi);
win_T *llwin = NULL;
win_T *orig_wp = wp;
if (qfwin != NULL)
{
/* If the quickfix/location list window is open, then clear it */
if (qi->qf_curlist < qi->qf_listcount)
qf_free(qi, qi->qf_curlist);
qf_update_buffer(qi, NULL);
}
if (wp != NULL && IS_LL_WINDOW(wp))
{
/* If in the location list window, then use the non-location list
* window with this location list (if present)
*/
llwin = find_win_with_ll(qi);
if (llwin != NULL)
wp = llwin;
}
qf_free_all(wp);
if (wp == NULL)
{
@@ -4876,6 +4918,18 @@ qf_free_stack(win_T *wp, qf_info_T *qi)
qi->qf_curlist = 0;
qi->qf_listcount = 0;
}
else if (IS_LL_WINDOW(orig_wp))
{
/* If the location list window is open, then create a new empty
* location list */
qf_info_T *new_ll = ll_new_list();
orig_wp->w_llist_ref = new_ll;
if (llwin != NULL)
{
llwin->w_llist = new_ll;
new_ll->qf_refcount++;
}
}
}
/*
+6
View File
@@ -515,6 +515,12 @@ struct buffheader
int bh_space; /* space in bh_curr for appending */
};
typedef struct
{
buffheader_T sr_redobuff;
buffheader_T sr_old_redobuff;
} save_redo_T;
/*
* used for completion on the command line
*/
-143
View File
@@ -1,143 +0,0 @@
; Thomas Leonard
; 24/5/98
ar0 rn 0
ar1 rn 1
ar2 rn 2
ar3 rn 3
ar4 rn 4
ar5 rn 5
ar6 rn 6
ar7 rn 7
ar10 rn 10
ar11 rn 11
lk rn 14
ar15 rn 15
AREA DATA
align 4
export |r0|
r0: dcd 0
export |r1|
r1: dcd 0
export |r2|
r2: dcd 0
export |r3|
r3: dcd 0
export |r4|
r4: dcd 0
export |r5|
r5: dcd 0
export |r6|
r6: dcd 0
export |r7|
r7: dcd 0
export |time_of_last_poll|
time_of_last_poll: dcd 0
AREA CODE, READONLY
align 4
import |r0|
export |swi|
= "swi"
align 4
swi:
; r0 = swi number
stmfd sp!,{ar4-ar10,lk}
orr ar10,ar0,#1<<17 ;always use the X form
mov ar0,ar1
mov ar1,ar2
mov ar2,ar3
add ar3,sp,#4*8
ldmia ar3,{ar3-ar7}
swi 0x6f ; OS_CallASWI
ldr ar10,regs_addr
stmia ar10,{ar0-ar7}
ldmvcfd sp!,{ar4-ar10,pc}^
; report the error and quit on Cancel
mov r1,#0x17
adr r2,s_title
swi 0x400df ; Wimp_ReportError
cmp r1,#1 ;OK selected?
ldmeqfd sp!,{ar4-ar10,pc}^ ;yes - try to continue
swi 0x11 ;no - die (OS_Exit)
s_title:
= "Nasty error - Cancel to quit"
= 0
align 4
export |xswi|
= "xswi"
align 4
xswi:
; r0 = swi number
stmfd sp!,{ar4-ar10,lk}
orr ar10,ar0,#1<<17 ;always use the X form
mov ar0,ar1
mov ar1,ar2
mov ar2,ar3
add ar3,sp,#4*8
ldmia ar3,{ar3-ar7}
swi 0x6f ; OS_CallASWI
ldr ar10,regs_addr
stmia ar10,{ar0-ar7}
mov ar0,#0
orr ar0,ar0,ar15
ldmfd sp!,{ar4-ar10,pc}^
regs_addr:
dcd r0
; The Wimp_Poll swis have to be done specially because,
; for some reason, r13 sometimes gets corrupted by Wimp_Poll
; (eg when running FileFind)
AREA CODE, READONLY
align 4
import |time_of_last_poll|
export |wimp_poll|
= "wimp_poll"
align 4
wimp_poll:
mov ar3,sp
swi 0x400c7 ; Wimp_Poll
mov sp,ar3
mov ar3,ar0
swi 0x42 ; OS_ReadMonotonicTime
ldr ar2,addr_time
str ar0,[ar2]
mov ar0,ar3
mov ar2,#0
wfs ar2 ; Write floating point status. Needed?
movs pc,lk
align 4
export |wimp_pollidle|
= "wimp_pollidle"
align 4
wimp_pollidle:
mov ar3,sp
swi 0x400e1 ; Wimp_PollIdle
mov sp,ar3
mov ar3,ar0
swi 0x42 ; OS_ReadMonotonicTime
ldr ar2,addr_time
str ar0,[ar2]
mov ar0,ar3
mov ar2,#0
wfs ar2 ; Write floating point status. Needed?
movs pc,lk
addr_time: dcd time_of_last_poll
+7 -6
View File
@@ -2355,18 +2355,19 @@ parse_line:
}
else
{
#define TAG_SEP 0x01
#define TAG_SEP 0x02
size_t tag_fname_len = STRLEN(tag_fname);
#ifdef FEAT_EMACS_TAGS
size_t ebuf_len = 0;
#endif
/* Save the tag in a buffer.
* Use 0x01 to separate fields (Can't use NUL, because the
* hash key is terminated by NUL).
* Emacs tag: <mtt><tag_fname><0x01><ebuf><0x01><lbuf><NUL>
* other tag: <mtt><tag_fname><0x01><0x01><lbuf><NUL>
* without Emacs tags: <mtt><tag_fname><0x01><lbuf><NUL>
* Use 0x02 to separate fields (Can't use NUL because the
* hash key is terminated by NUL, or Ctrl_A because that is
* part of some Emacs tag files -- see parse_tag_line).
* Emacs tag: <mtt><tag_fname><0x02><ebuf><0x02><lbuf><NUL>
* other tag: <mtt><tag_fname><0x02><0x02><lbuf><NUL>
* without Emacs tags: <mtt><tag_fname><0x02><lbuf><NUL>
* Here <mtt> is the "mtt" value plus 1 to avoid NUL.
*/
len = (int)tag_fname_len + (int)STRLEN(lbuf) + 3;
+101 -25
View File
@@ -845,9 +845,11 @@ static struct builtin_term builtin_termcaps[] =
ESC_STR "[8;%p1%d;%p2%dt")},
{(int)KS_CWP, IF_EB("\033[3;%p1%d;%p2%dt",
ESC_STR "[3;%p1%d;%p2%dt")},
{(int)KS_CGP, IF_EB("\033[13t", ESC_STR "[13t")},
# else
{(int)KS_CWS, IF_EB("\033[8;%d;%dt", ESC_STR "[8;%d;%dt")},
{(int)KS_CWP, IF_EB("\033[3;%d;%dt", ESC_STR "[3;%d;%dt")},
{(int)KS_CGP, IF_EB("\033[13t", ESC_STR "[13t")},
# endif
{(int)KS_CRV, IF_EB("\033[>c", ESC_STR "[>c")},
{(int)KS_RBG, IF_EB("\033]11;?\007", ESC_STR "]11;?\007")},
@@ -1711,7 +1713,8 @@ set_termname(char_u *term)
{
screen_start(); /* don't know where cursor is now */
out_flush();
ui_delay(2000L, TRUE);
if (!is_not_a_term())
ui_delay(2000L, TRUE);
}
set_string_option_direct((char_u *)"term", -1, term,
OPT_FREE, 0);
@@ -2586,6 +2589,60 @@ term_set_winpos(int x, int y)
OUT_STR(tgoto((char *)T_CWP, y, x));
}
# if defined(FEAT_TERMRESPONSE) || defined(PROTO)
/*
* Return TRUE if we can request the terminal for a response.
*/
static int
can_get_termresponse()
{
return cur_tmode == TMODE_RAW
&& termcap_active
# ifdef UNIX
&& (is_not_a_term() || (isatty(1) && isatty(read_cmd_fd)))
# endif
&& p_ek;
}
static int winpos_x;
static int winpos_y;
static int waiting_for_winpos = FALSE;
/*
* Try getting the Vim window position from the terminal.
* Returns OK or FAIL.
*/
int
term_get_winpos(int *x, int *y)
{
int count = 0;
if (*T_CGP == NUL || !can_get_termresponse())
return FAIL;
winpos_x = -1;
winpos_y = -1;
waiting_for_winpos = TRUE;
OUT_STR(T_CGP);
out_flush();
/* Try reading the result for 100 msec. */
while (count++ < 10)
{
(void)vpeekc_nomap();
if (winpos_x >= 0 && winpos_y >= 0)
{
*x = winpos_x;
*y = winpos_y;
waiting_for_winpos = FALSE;
return OK;
}
ui_delay(10, FALSE);
}
waiting_for_winpos = FALSE;
return FALSE;
}
# endif
void
term_set_winsize(int width, int height)
{
@@ -3234,14 +3291,8 @@ stoptermcap(void)
may_req_termresponse(void)
{
if (crv_status == CRV_GET
&& cur_tmode == TMODE_RAW
&& can_get_termresponse()
&& starting == 0
&& termcap_active
&& p_ek
# ifdef UNIX
&& isatty(1)
&& isatty(read_cmd_fd)
# endif
&& *T_CRV != NUL)
{
LOG_TR("Sending CRV");
@@ -3268,13 +3319,8 @@ may_req_termresponse(void)
may_req_ambiguous_char_width(void)
{
if (u7_status == U7_GET
&& cur_tmode == TMODE_RAW
&& termcap_active
&& p_ek
# ifdef UNIX
&& isatty(1)
&& isatty(read_cmd_fd)
# endif
&& can_get_termresponse()
&& starting == 0
&& *T_U7 != NUL
&& !option_was_set((char_u *)"ambiwidth"))
{
@@ -3300,7 +3346,6 @@ may_req_ambiguous_char_width(void)
}
# endif
#if defined(FEAT_TERMRESPONSE) || defined(PROTO)
/*
* Similar to requesting the version string: Request the terminal background
* color when it is the right moment.
@@ -3309,13 +3354,8 @@ may_req_ambiguous_char_width(void)
may_req_bg_color(void)
{
if (rbg_status == RBG_GET
&& cur_tmode == TMODE_RAW
&& termcap_active
&& p_ek
# ifdef UNIX
&& isatty(1)
&& isatty(read_cmd_fd)
# endif
&& can_get_termresponse()
&& starting == 0
&& *T_RBG != NUL
&& !option_was_set((char_u *)"bg"))
{
@@ -3328,7 +3368,6 @@ may_req_bg_color(void)
(void)vpeekc_nomap();
}
}
# endif
# ifdef DEBUG_TERMRESPONSE
static void
@@ -4141,10 +4180,12 @@ check_termcode(
* - Cursor position report: <Esc>[{row};{col}R
* The final byte must be 'R'. It is used for checking the
* ambiguous-width character state.
*
* - window position reply: <Esc>[3;{x};{y}t
*/
char_u *argp = tp[0] == ESC ? tp + 2 : tp + 1;
if ((*T_CRV != NUL || *T_U7 != NUL)
if ((*T_CRV != NUL || *T_U7 != NUL || waiting_for_winpos)
&& ((tp[0] == ESC && len >= 3 && tp[1] == '[')
|| (tp[0] == CSI && len >= 2))
&& (VIM_ISDIGIT(*argp) || *argp == '>' || *argp == '?'))
@@ -4283,6 +4324,41 @@ check_termcode(
key_name[1] = (int)KE_IGNORE;
slen = i + 1;
}
/*
* Check for a window position response from the terminal:
* {lead}3;{x}:{y}t
*/
else if (waiting_for_winpos
&& ((len >= 4 && tp[0] == ESC && tp[1] == '[')
|| (len >= 3 && tp[0] == CSI))
&& tp[(j = 1 + (tp[0] == ESC))] == '3'
&& tp[j + 1] == ';')
{
j += 2;
for (i = j; i < len && vim_isdigit(tp[i]); ++i)
;
if (i < len && tp[i] == ';')
{
winpos_x = atoi((char *)tp + j);
j = i + 1;
for (i = j; i < len && vim_isdigit(tp[i]); ++i)
;
if (i < len && tp[i] == 't')
{
winpos_y = atoi((char *)tp + j);
/* got finished code: consume it */
key_name[0] = (int)KS_EXTRA;
key_name[1] = (int)KE_IGNORE;
slen = i + 1;
}
}
if (i == len)
{
LOG_TR("not enough characters for winpos");
return -1;
}
}
}
/* Check for background color response from the terminal:
+3 -1
View File
@@ -77,6 +77,7 @@ enum SpecialKey
KS_TS, /* set window title start (to status line)*/
KS_FS, /* set window title end (from status line) */
KS_CWP, /* set window position in pixels */
KS_CGP, /* get window position */
KS_CWS, /* set window size in characters */
KS_CRV, /* request version string */
KS_RBG, /* request background color */
@@ -163,7 +164,8 @@ extern char_u *(term_strings[]); /* current terminal strings */
#define T_CIE (TERM_STR(KS_CIE)) /* set icon text end */
#define T_TS (TERM_STR(KS_TS)) /* set window title start */
#define T_FS (TERM_STR(KS_FS)) /* set window title end */
#define T_CWP (TERM_STR(KS_CWP)) /* window position */
#define T_CWP (TERM_STR(KS_CWP)) /* set window position */
#define T_CGP (TERM_STR(KS_CGP)) /* get window position */
#define T_CWS (TERM_STR(KS_CWS)) /* window size */
#define T_CSI (TERM_STR(KS_CSI)) /* start insert mode */
#define T_CEI (TERM_STR(KS_CEI)) /* end insert mode */
+3 -2
View File
@@ -8,10 +8,11 @@ source test_changedtick.vim
source test_cursor_func.vim
source test_delete.vim
source test_ex_undo.vim
source test_ex_z.vim
source test_execute_func.vim
source test_expand.vim
source test_expr.vim
source test_expand_dllpath.vim
source test_expr.vim
source test_feedkeys.vim
source test_file_perm.vim
source test_fileformat.vim
@@ -30,9 +31,9 @@ source test_join.vim
source test_jumps.vim
source test_lambda.vim
source test_lispwords.vim
source test_mapping.vim
source test_match.vim
source test_menu.vim
source test_mapping.vim
source test_messages.vim
source test_partial.vim
source test_popup.vim
+14
View File
@@ -65,6 +65,10 @@ func Test_highlight_completion()
hi Aardig ctermfg=green
call feedkeys(":hi \<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"hi Aardig', getreg(':'))
call feedkeys(":hi default \<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"hi default Aardig', getreg(':'))
call feedkeys(":hi clear Aa\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"hi clear Aardig', getreg(':'))
call feedkeys(":hi li\<S-Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"hi link', getreg(':'))
call feedkeys(":hi d\<S-Tab>\<Home>\"\<CR>", 'xt')
@@ -412,4 +416,14 @@ func Test_getcmdtype()
cunmap <F6>
endfunc
func Test_verbosefile()
set verbosefile=Xlog
echomsg 'foo'
echomsg 'bar'
set verbosefile=
let log = readfile('Xlog')
call assert_match("foo\nbar", join(log, "\n"))
call delete('Xlog')
endfunc
set cpo&
+41
View File
@@ -1322,3 +1322,44 @@ func! Test_edit_rightleft()
set norightleft
bw!
endfunc
func Test_edit_complete_very_long_name()
if !has('unix')
" Long directory names only work on Unix.
return
endif
let dirname = getcwd() . "/Xdir"
let longdirname = dirname . repeat('/' . repeat('d', 255), 4)
try
call mkdir(longdirname, 'p')
catch /E739:/
" Long directory name probably not supported.
call delete(dirname, 'rf')
return
endtry
" Try to get the Vim window position before setting 'columns'.
let winposx = getwinposx()
let winposy = getwinposy()
let save_columns = &columns
" Need at least about 1100 columns to reproduce the problem.
set columns=2000
call assert_equal(2000, &columns)
set noswapfile
let longfilename = longdirname . '/' . repeat('a', 255)
call writefile(['Totum', 'Table'], longfilename)
new
exe "next Xfile " . longfilename
exe "normal iT\<C-N>"
bwipe!
exe 'bwipe! ' . longfilename
call delete(dirname, 'rf')
let &columns = save_columns
if winposx >= 0 && winposy >= 0
exe 'winpos ' . winposx . ' ' . winposy
endif
set swapfile&
endfunc
+78
View File
@@ -0,0 +1,78 @@
" Test :z
func Test_z()
call setline(1, range(1, 100))
let a = execute('20z3')
call assert_equal("\n20\n21\n22", a)
call assert_equal(22, line('.'))
" 'window' should be set to the {count} value.
call assert_equal(3, &window)
" If there is only one window, then twice the amount of 'scroll' is used.
set scroll=2
let a = execute('20z')
call assert_equal("\n20\n21\n22\n23", a)
call assert_equal(23, line('.'))
let a = execute('20z+3')
" FIXME: I would expect the same result as '20z3' but it
" gives "\n21\n22\n23" instead. Bug in Vim or in ":help :z"?
"call assert_equal("\n20\n21\n22", a)
"call assert_equal(22, line('.'))
let a = execute('20z-3')
call assert_equal("\n18\n19\n20", a)
call assert_equal(20, line('.'))
let a = execute('20z=3')
call assert_match("^\n18\n19\n-\\+\n20\n-\\+\n21\n22$", a)
call assert_equal(20, line('.'))
let a = execute('20z^3')
call assert_equal("\n14\n15\n16\n17", a)
call assert_equal(17, line('.'))
let a = execute('20z.3')
call assert_equal("\n19\n20\n21", a)
call assert_equal(21, line('.'))
let a = execute('20z#3')
call assert_equal("\n 20 20\n 21 21\n 22 22", a)
call assert_equal(22, line('.'))
let a = execute('20z#-3')
call assert_equal("\n 18 18\n 19 19\n 20 20", a)
call assert_equal(20, line('.'))
let a = execute('20z#=3')
call assert_match("^\n 18 18\n 19 19\n-\\+\n 20 20\n-\\+\n 21 21\n 22 22$", a)
call assert_equal(20, line('.'))
" Test with {count} bigger than the number of lines in buffer.
let a = execute('20z1000')
call assert_match("^\n20\n21\n.*\n99\n100$", a)
call assert_equal(100, line('.'))
let a = execute('20z-1000')
call assert_match("^\n1\n2\n.*\n19\n20$", a)
call assert_equal(20, line('.'))
let a = execute('20z=1000')
call assert_match("^\n1\n.*\n-\\+\n20\n-\\\+\n.*\n100$", a)
call assert_equal(20, line('.'))
call assert_fails('20z=a', 'E144:')
set window& scroll&
bw!
endfunc
func Test_z_bug()
" This used to access invalid memory as a result of an integer overflow
" and freeze vim.
normal ox
normal Heat
z777777776666666
')
endfunc
+28
View File
@@ -756,3 +756,31 @@ func Test_setbufvar_options()
call win_gotoid(dum1_id)
bwipe!
endfunc
func Test_redo_in_nested_functions()
nnoremap g. :set opfunc=Operator<CR>g@
function Operator( type, ... )
let @x = 'XXX'
execute 'normal! g`[' . (a:type ==# 'line' ? 'V' : 'v') . 'g`]' . '"xp'
endfunction
function! Apply()
5,6normal! .
endfunction
new
call setline(1, repeat(['some "quoted" text', 'more "quoted" text'], 3))
1normal g.i"
call assert_equal('some "XXX" text', getline(1))
3,4normal .
call assert_equal('some "XXX" text', getline(3))
call assert_equal('more "XXX" text', getline(4))
call Apply()
call assert_equal('some "XXX" text', getline(5))
call assert_equal('more "XXX" text', getline(6))
bwipe!
nunmap g.
delfunc Operator
delfunc Apply
endfunc
+11
View File
@@ -160,3 +160,14 @@ func Test_map_meta_quotes()
set nomodified
iunmap <M-">
endfunc
func Test_abbr_after_line_join()
new
abbr foo bar
set backspace=indent,eol,start
exe "normal o\<BS>foo "
call assert_equal("bar ", getline(1))
bwipe!
unabbr foo
set backspace&
endfunc
+83 -7
View File
@@ -844,7 +844,7 @@ func! Test_normal18_z_fold()
norm! j
call assert_equal('52', getline('.'))
" zA on a opened fold when foldenale is not set
" zA on a opened fold when foldenable is not set
50
set nofoldenable
norm! zA
@@ -906,7 +906,7 @@ func! Test_normal18_z_fold()
norm! j
call assert_equal('55', getline('.'))
" 2) do not close fold under curser
" 2) do not close fold under cursor
51
set nofoldenable
norm! zx
@@ -1603,6 +1603,40 @@ fun! Test_normal30_changecase()
norm! V~
call assert_equal('THIS IS A simple test: äüöss', getline('.'))
" Turkish ASCII turns to multi-byte. On Mac the Turkish locale is available
" but toupper()/tolower() don't do the right thing.
if !has('mac') && !has('osx')
try
lang tr_TR.UTF-8
set casemap=
call setline(1, 'iI')
1normal gUU
call assert_equal("\u0130I", getline(1))
call assert_equal("\u0130I", toupper("iI"))
call setline(1, 'iI')
1normal guu
call assert_equal("i\u0131", getline(1))
call assert_equal("i\u0131", tolower("iI"))
set casemap&
call setline(1, 'iI')
1normal gUU
call assert_equal("II", getline(1))
call assert_equal("II", toupper("iI"))
call setline(1, 'iI')
1normal guu
call assert_equal("ii", getline(1))
call assert_equal("ii", tolower("iI"))
lang en_US.UTF-8
catch /E197:/
" can't use Turkish locale
throw 'Skipped: Turkish locale not available'
endtry
endif
" clean up
bw!
endfunc
@@ -1772,18 +1806,60 @@ fun! Test_normal34_g_cmd3()
if !has("multi_byte")
return
endif
" Test for g8
new
call append(0, 'abcdefghijklmnopqrstuvwxyzäüö')
let a=execute(':norm! 1gg$g8')
call assert_equal('c3 b6 ', a[1:])
let a=execute(':norm! 1G0g8')
call assert_equal("\nNUL", a)
call setline(1, 'abcdefghijklmnopqrstuvwxyzäüö')
let a=execute(':norm! 1G$g8')
call assert_equal("\nc3 b6 ", a)
call setline(1, "a\u0302")
let a=execute(':norm! 1G0g8')
call assert_equal("\n61 + cc 82 ", a)
" Test for gp gP
call append(1, range(1,10))
" clean up
bw!
endfunc
func Test_normal_8g8()
if !has("multi_byte")
return
endif
new
" Test 8g8 which finds invalid utf8 at or after the cursor.
" With invalid byte.
call setline(1, "___\xff___")
norm! 1G08g8g
call assert_equal([0, 1, 4, 0, 1], getcurpos())
" With invalid byte before the cursor.
call setline(1, "___\xff___")
norm! 1G$h8g8g
call assert_equal([0, 1, 6, 0, 9], getcurpos())
" With truncated sequence.
call setline(1, "___\xE2\x82___")
norm! 1G08g8g
call assert_equal([0, 1, 4, 0, 1], getcurpos())
" With overlong sequence.
call setline(1, "___\xF0\x82\x82\xAC___")
norm! 1G08g8g
call assert_equal([0, 1, 4, 0, 1], getcurpos())
" With valid utf8.
call setline(1, "café")
norm! 1G08g8
call assert_equal([0, 1, 1, 0, 1], getcurpos())
bw!
endfunc
fun! Test_normal35_g_cmd4()
" Test for g<
" Cannot capture its output,
+16 -4
View File
@@ -280,10 +280,22 @@ func Test_set_ttytype()
set ttytype=xterm
call assert_equal('xterm', &ttytype)
call assert_equal(&ttytype, &term)
" FIXME: "set ttytype=" gives E522 instead of E529
" in travis on some builds. Why? Commented out this test for now.
" call assert_fails('set ttytype=', 'E529:')
call assert_fails('set ttytype=xxx', 'E522:')
" "set ttytype=" gives E522 instead of E529
" in travis on some builds. Why? Catch both for now
try
set ttytype=
call assert_report('set ttype= did not fail')
catch /E529\|E522/
endtry
" Some systems accept any terminal name and return dumb settings,
" check for failure of finding the entry and for missing 'cm' entry.
try
set ttytype=xxx
call assert_report('set ttype=xxx did not fail')
catch /E522\|E437/
endtry
set ttytype&
call assert_equal(&ttytype, &term)
endif
+63
View File
@@ -1912,3 +1912,66 @@ func Test_vimgrep()
call XvimgrepTests('c')
call XvimgrepTests('l')
endfunc
func XfreeTests(cchar)
call s:setup_commands(a:cchar)
enew | only
" Deleting the quickfix stack should work even When the current list is
" somewhere in the middle of the stack
Xexpr ['Xfile1:10:10:Line 10', 'Xfile1:15:15:Line 15']
Xexpr ['Xfile2:20:20:Line 20', 'Xfile2:25:25:Line 25']
Xexpr ['Xfile3:30:30:Line 30', 'Xfile3:35:35:Line 35']
Xolder
call g:Xsetlist([], 'f')
call assert_equal(0, len(g:Xgetlist()))
" After deleting the stack, adding a new list should create a stack with a
" single list.
Xexpr ['Xfile1:10:10:Line 10', 'Xfile1:15:15:Line 15']
call assert_equal(1, g:Xgetlist({'all':1}).nr)
" Deleting the stack from a quickfix window should update/clear the
" quickfix/location list window.
Xexpr ['Xfile1:10:10:Line 10', 'Xfile1:15:15:Line 15']
Xexpr ['Xfile2:20:20:Line 20', 'Xfile2:25:25:Line 25']
Xexpr ['Xfile3:30:30:Line 30', 'Xfile3:35:35:Line 35']
Xolder
Xwindow
call g:Xsetlist([], 'f')
call assert_equal(2, winnr('$'))
call assert_equal(1, line('$'))
Xclose
" Deleting the stack from a non-quickfix window should update/clear the
" quickfix/location list window.
Xexpr ['Xfile1:10:10:Line 10', 'Xfile1:15:15:Line 15']
Xexpr ['Xfile2:20:20:Line 20', 'Xfile2:25:25:Line 25']
Xexpr ['Xfile3:30:30:Line 30', 'Xfile3:35:35:Line 35']
Xolder
Xwindow
wincmd p
call g:Xsetlist([], 'f')
call assert_equal(0, len(g:Xgetlist()))
wincmd p
call assert_equal(2, winnr('$'))
call assert_equal(1, line('$'))
" After deleting the location list stack, if the location list window is
" opened, then a new location list should be created. So opening the
" location list window again should not create a new window.
if a:cchar == 'l'
lexpr ['Xfile1:10:10:Line 10', 'Xfile1:15:15:Line 15']
wincmd p
lopen
call assert_equal(2, winnr('$'))
endif
Xclose
endfunc
" Tests for the quickifx free functionality
func Test_qf_free()
call XfreeTests('c')
call XfreeTests('l')
endfunc
+2 -4
View File
@@ -112,12 +112,10 @@ func s:classes_test()
call assert_equal('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', alnumchars)
call assert_equal("\b", backspacechar)
call assert_equal("\t ", blankchars)
" Commented out: it succeeds on Linux and Windows, but fails on macOs in Travis.
" call assert_equal("\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0b\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\e\x1c\x1d\x1e\x1f\x7f", cntrlchars)
call assert_equal("\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0b\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\e\x1c\x1d\x1e\x1f\x7f", cntrlchars)
call assert_equal("0123456789", digitchars)
call assert_equal("\<Esc>", escapechar)
" Commented out: it succeeds on Linux and Windows, but fails on macOs in Travis.
" call assert_equal('!"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~', graphchars)
call assert_equal('!"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~', graphchars)
call assert_equal('abcdefghijklmnopqrstuvwxyzµßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ', lowerchars)
call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ', printchars)
call assert_equal('!"#$%&''()*+,-./:;<=>?@[\]^_`{|}~', punctchars)
+13
View File
@@ -208,3 +208,16 @@ func Test_silent_ex_mode()
let out = system(GetVimCommand() . '-u NONE -es -c''set verbose=1|h|exe "%norm\<c-y>\<c-d>"'' -c cq')
call assert_notmatch('E315:', out)
endfunc
func Test_default_term()
if !has('unix') || has('gui_running')
" can't get output of Vim.
return
endif
let save_term = $TERM
let $TERM = 'unknownxxx'
let out = system(GetVimCommand() . ' -c''set term'' -c cq')
call assert_match("defaulting to 'ansi'", out)
let $TERM = save_term
endfunc
+53 -1
View File
@@ -304,12 +304,18 @@ func Test_syntax_arg_skipped()
syn clear
endfunc
func Test_invalid_arg()
func Test_syntax_invalid_arg()
call assert_fails('syntax case asdf', 'E390:')
if has('conceal')
call assert_fails('syntax conceal asdf', 'E390:')
endif
call assert_fails('syntax spell asdf', 'E390:')
call assert_fails('syntax clear @ABCD', 'E391:')
call assert_fails('syntax include @Xxx', 'E397:')
call assert_fails('syntax region X start="{"', 'E399:')
call assert_fails('syntax sync x', 'E404:')
call assert_fails('syntax keyword Abc a[', 'E789:')
call assert_fails('syntax keyword Abc a[bc]d', 'E890:')
endfunc
func Test_syn_sync()
@@ -349,3 +355,49 @@ func Test_invalid_name()
hi clear Nop
hi clear @Wrong
endfunc
func Test_ownsyntax()
new Xfoo
call setline(1, '#define FOO')
syntax on
set filetype=c
ownsyntax perl
call assert_equal('perlComment', synIDattr(synID(line('.'), col('.'), 1), 'name'))
call assert_equal('c', b:current_syntax)
call assert_equal('perl', w:current_syntax)
" A new split window should have the original syntax.
split
call assert_equal('cDefine', synIDattr(synID(line('.'), col('.'), 1), 'name'))
call assert_equal('c', b:current_syntax)
call assert_equal(0, exists('w:current_syntax'))
wincmd x
call assert_equal('perlComment', synIDattr(synID(line("."), col("."), 1), "name"))
syntax off
set filetype&
%bw!
endfunc
func Test_ownsyntax_completion()
call feedkeys(":ownsyntax java\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"ownsyntax java javacc javascript', @:)
endfunc
func Test_highlight_invalid_arg()
if has('gui_running')
call assert_fails('hi XXX guifg=xxx', 'E254:')
endif
call assert_fails('hi DoesNotExist', 'E411:')
call assert_fails('hi link', 'E412:')
call assert_fails('hi link a', 'E412:')
call assert_fails('hi link a b c', 'E413:')
call assert_fails('hi XXX =', 'E415:')
call assert_fails('hi XXX cterm', 'E416:')
call assert_fails('hi XXX cterm=', 'E417:')
call assert_fails('hi XXX cterm=DoesNotExist', 'E418:')
call assert_fails('hi XXX ctermfg=DoesNotExist', 'E421:')
call assert_fails('hi XXX xxx=White', 'E423:')
endfunc
+37
View File
@@ -19,3 +19,40 @@ func Test_taglist()
bwipe
endfunc
func Test_taglist_native_etags()
if !has('emacs_tags')
return
endif
call writefile([
\ "\x0c",
\ "src/os_unix.c,13491",
\ "set_signals(\x7f1335,32699",
\ "reset_signals(\x7f1407,34136",
\ ], 'Xtags')
set tags=Xtags
call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
\ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))
call delete('Xtags')
endfunc
func Test_taglist_ctags_etags()
if !has('emacs_tags')
return
endif
call writefile([
\ "\x0c",
\ "src/os_unix.c,13491",
\ "set_signals(void)\x7fset_signals\x011335,32699",
\ "reset_signals(void)\x7freset_signals\x011407,34136",
\ ], 'Xtags')
set tags=Xtags
call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
\ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))
call delete('Xtags')
endfunc
+11
View File
@@ -1309,6 +1309,17 @@ func Test_script_lines()
endtry
endfunc
"-------------------------------------------------------------------------------
" Test 96: line continuation {{{1
"
" Undefined behavior was detected by ubsan with line continuation
" after an empty line.
"-------------------------------------------------------------------------------
func Test_script_emty_line_continuation()
\
endfunc
"-------------------------------------------------------------------------------
" Modelines {{{1
" vim: ts=8 sw=4 tw=80 fdm=marker
+61 -41
View File
@@ -41,7 +41,7 @@ static garray_T funcargs = GA_EMPTY;
/* pointer to funccal for currently active function */
funccall_T *current_funccal = NULL;
/* pointer to list of previously used funccal, still around because some
/* Pointer to list of previously used funccal, still around because some
* item in it is still being used. */
funccall_T *previous_funccal = NULL;
@@ -627,6 +627,55 @@ free_funccal(
vim_free(fc);
}
/*
* Handle the last part of returning from a function: free the local hashtable.
* Unless it is still in use by a closure.
*/
static void
cleanup_function_call(funccall_T *fc)
{
current_funccal = fc->caller;
/* If the a:000 list and the l: and a: dicts are not referenced and there
* is no closure using it, we can free the funccall_T and what's in it. */
if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT
&& fc->l_vars.dv_refcount == DO_NOT_FREE_CNT
&& fc->l_avars.dv_refcount == DO_NOT_FREE_CNT
&& fc->fc_refcount <= 0)
{
free_funccal(fc, FALSE);
}
else
{
hashitem_T *hi;
listitem_T *li;
int todo;
dictitem_T *v;
/* "fc" is still in use. This can happen when returning "a:000",
* assigning "l:" to a global variable or defining a closure.
* Link "fc" in the list for garbage collection later. */
fc->caller = previous_funccal;
previous_funccal = fc;
/* Make a copy of the a: variables, since we didn't do that above. */
todo = (int)fc->l_avars.dv_hashtab.ht_used;
for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
{
--todo;
v = HI2DI(hi);
copy_tv(&v->di_tv, &v->di_tv);
}
}
/* Make a copy of the a:000 items, since we didn't do that above. */
for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
copy_tv(&li->li_tv, &li->li_tv);
}
}
/*
* Call a user function.
*/
@@ -982,46 +1031,9 @@ call_user_func(
}
did_emsg |= save_did_emsg;
current_funccal = fc->caller;
--depth;
/* If the a:000 list and the l: and a: dicts are not referenced and there
* is no closure using it, we can free the funccall_T and what's in it. */
if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT
&& fc->l_vars.dv_refcount == DO_NOT_FREE_CNT
&& fc->l_avars.dv_refcount == DO_NOT_FREE_CNT
&& fc->fc_refcount <= 0)
{
free_funccal(fc, FALSE);
}
else
{
hashitem_T *hi;
listitem_T *li;
int todo;
/* "fc" is still in use. This can happen when returning "a:000",
* assigning "l:" to a global variable or defining a closure.
* Link "fc" in the list for garbage collection later. */
fc->caller = previous_funccal;
previous_funccal = fc;
/* Make a copy of the a: variables, since we didn't do that above. */
todo = (int)fc->l_avars.dv_hashtab.ht_used;
for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
{
--todo;
v = HI2DI(hi);
copy_tv(&v->di_tv, &v->di_tv);
}
}
/* Make a copy of the a:000 items, since we didn't do that above. */
for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
copy_tv(&li->li_tv, &li->li_tv);
}
cleanup_function_call(fc);
}
/*
@@ -1147,6 +1159,13 @@ free_all_functions(void)
long_u todo = 1;
long_u used;
/* Clean up the call stack. */
while (current_funccal != NULL)
{
clear_tv(current_funccal->rettv);
cleanup_function_call(current_funccal);
}
/* First clear what the functions contain. Since this may lower the
* reference count of a function, it may also free a function and change
* the hash table. Restart if that happens. */
@@ -1389,6 +1408,7 @@ call_func(
else
{
int did_save_redo = FALSE;
save_redo_T save_redo;
/*
* Call the user function.
@@ -1400,7 +1420,7 @@ call_func(
if (!ins_compl_active())
#endif
{
saveRedobuff();
saveRedobuff(&save_redo);
did_save_redo = TRUE;
}
++fp->uf_calls;
@@ -1412,7 +1432,7 @@ call_func(
* now. */
func_clear_free(fp, FALSE);
if (did_save_redo)
restoreRedobuff();
restoreRedobuff(&save_redo);
restore_search_patterns();
error = ERROR_NONE;
}
+84
View File
@@ -779,6 +779,90 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
567,
/**/
566,
/**/
565,
/**/
564,
/**/
563,
/**/
562,
/**/
561,
/**/
560,
/**/
559,
/**/
558,
/**/
557,
/**/
556,
/**/
555,
/**/
554,
/**/
553,
/**/
552,
/**/
551,
/**/
550,
/**/
549,
/**/
548,
/**/
547,
/**/
546,
/**/
545,
/**/
544,
/**/
543,
/**/
542,
/**/
541,
/**/
540,
/**/
539,
/**/
538,
/**/
537,
/**/
536,
/**/
535,
/**/
534,
/**/
533,
/**/
532,
/**/
531,
/**/
530,
/**/
529,
/**/
528,
/**/
527,
/**/
526,
/**/
525,
/**/