Compare commits

...

16 Commits

Author SHA1 Message Date
Bram Moolenaar
5ce4a0b96a patch 7.4.1908
Problem:    Netbeans uses uninitialzed pointer and freed memory.
Solution:   Set "buffer" at the right place (hint by Ken Takata)
2016-06-08 20:17:23 +02:00
Bram Moolenaar
1d5f1d07ae patch 7.4.1907
Problem:    Warnings from 64 bit compiler.
Solution:   Change type to size_t. (Mike Williams)
2016-06-07 22:50:01 +02:00
Bram Moolenaar
5f1032d2a5 patch 7.4.1906
Problem:    Collapsing channel buffers and searching for NL does not work
            properly. (Xavier de Gary, Ramel Eshed)
Solution:   Do not assume the buffer contains a NUL or not.  Change NUL bytes
            to NL to avoid the string is truncated.
2016-06-07 22:16:36 +02:00
Bram Moolenaar
fdd82fe365 patch 7.4.1905
Problem:    Some compilers can't handle a double semicolon.
Solution:   Remove one semicolon.
2016-06-06 21:38:44 +02:00
Bram Moolenaar
c60954b48e patch 7.4.1904
Problem:    Build fails.
Solution:   Add missing changes.
2016-06-06 21:20:10 +02:00
Bram Moolenaar
45d2eeaad6 patch 7.4.1903
Problem:    When writing viminfo merging current history with history in
            viminfo may drop recent history entries.
Solution:   Add new format for viminfo lines, use it for history entries.  Use
            a timestamp for ordering the entries. Add test_settime().
            Add the viminfo version.  Does not do merging on timestamp yet.
2016-06-06 21:07:52 +02:00
Bram Moolenaar
bbe8d91e69 patch 7.4.1902
Problem:    No test for collapsing buffers for a channel.  Some text is lost.
Solution:   Add a simple test.  Set rq_buflen correctly.
2016-06-05 16:10:57 +02:00
Bram Moolenaar
762f175437 patch 7.4.1901
Problem:    Win32: the "Disabled" menu items would appear enabled.
Solution:   Use submenu_id if there is a parent. (Shane Harper, closes #834)
2016-06-04 22:36:17 +02:00
Bram Moolenaar
28b942a064 patch 7.4.1900
Problem:    Using CTRL-] in the help on "{address}." doesn't work.
Solution:   Recognize an item in {}. (Hirohito Higashi, closes #814)
2016-06-04 22:31:27 +02:00
Bram Moolenaar
8e31fd52ec patch 7.4.1899
Problem:    GTK 3: cursor blinking doesn't work well.
Solution:   Instead of gui_gtk_window_clear() use gui_mch_clear_block().
            (Kazunobu Kuriyama)
2016-06-04 22:18:13 +02:00
Bram Moolenaar
63a60ded3f patch 7.4.1898
Problem:    User commands don't support modifiers.
Solution:   Add the <mods> item. (Yegappan Lakshmanan, closes #829)
2016-06-04 22:08:55 +02:00
Bram Moolenaar
fd89d7ea81 patch 7.4.1897
Problem:    Various typos, long lines and style mistakes.
Solution:   Fix the typos, wrap lines, improve style.
2016-06-04 20:25:05 +02:00
Bram Moolenaar
82af8710bf Updated runtime files. 2016-06-04 20:20:29 +02:00
Bram Moolenaar
82faa259cc patch 7.4.1896
Problem:    Invoking mark_adjust() when adding a new line below the last line
            is pointless.
Solution:   Skip calling mark_adjust() when appending below the last line.
2016-06-04 20:14:07 +02:00
Bram Moolenaar
888ccac890 patch 7.4.1895
Problem:    Cannot use a window ID where a window number is expected.
Solution:   Add LOWEST_WIN_ID, so that the window ID can be used where a
            number is expected.
2016-06-04 18:49:36 +02:00
Bram Moolenaar
511972d810 patch 7.4.1894
Problem:    Cannot get the window ID for a mouse click.
Solution:   Add v:mouse_winid.
2016-06-04 18:09:59 +02:00
50 changed files with 1187 additions and 263 deletions

View File

@@ -1,4 +1,4 @@
*channel.txt* For Vim version 7.4. Last change: 2016 May 29
*channel.txt* For Vim version 7.4. Last change: 2016 Jun 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -573,7 +573,7 @@ See |job_setoptions()| and |ch_setoptions()|.
"err_cb" wasn't set the channel callback is used.
*job-close_cb*
"close_cb": handler Callback for when the channel is closed. Same as
"close_cb" on ch_open().
"close_cb" on |ch_open()|, see |close_cb|.
*job-exit_cb*
"exit_cb": handler Callback for when the job ends. The arguments are the
job and the exit status.
@@ -659,10 +659,14 @@ When using JS or JSON mode with "buffer", only messages with zero or negative
ID will be added to the buffer, after decoding + encoding. Messages with a
positive number will be handled by a callback, commands are handled as usual.
The name of the buffer is compared the full name of existing buffers. If
there is a match that buffer is used. Otherwise a new buffer is created.
Use an empty name to always create a new buffer. |ch_getbufnr()| can then be
used to get the buffer number.
The name of the buffer from "out_name" or "err_name" is compared the full name
of existing buffers, also after expanding the name for the current directory.
E.g., when a buffer was created with ":edit somename" and the buffer name is
"somename" it will use that buffer.
If there is no matching buffer a new buffer is created. Use an empty name to
always create a new buffer. |ch_getbufnr()| can then be used to get the
buffer number.
For a new buffer 'buftype' is set to "nofile" and 'bufhidden' to "hide". If
you prefer other settings, create the buffer first and pass the buffer number.

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2016 May 25
*eval.txt* For Vim version 7.4. Last change: 2016 Jun 04
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1358,6 +1358,10 @@ v:beval_winnr The number of the window, over which the mouse pointer is. Only
window has number zero (unlike most other places where a
window gets a number).
*v:beval_winid* *beval_winid-variable*
v:beval_winid The window ID of the window, over which the mouse pointer is.
Otherwise like v:beval_winnr.
*v:char* *char-variable*
v:char Argument for evaluating 'formatexpr' and used for the typed
character when using <expr> in an abbreviation |:map-<expr>|.
@@ -1591,6 +1595,10 @@ v:mouse_win Window number for a mouse click obtained with |getchar()|.
First window has number 1, like with |winnr()|. The value is
zero when there was no mouse button click.
*v:mouse_winid* *mouse_winid-variable*
v:mouse_winid Window ID for a mouse click obtained with |getchar()|.
The value is zero when there was no mouse button click.
*v:mouse_lnum* *mouse_lnum-variable*
v:mouse_lnum Line number for a mouse click obtained with |getchar()|.
This is the text line number, not the screen line number. The
@@ -1821,7 +1829,7 @@ v:windowid When any X11 based GUI is running or when running in a
When an MS-Windows GUI is running this will be set to the
window handle.
Otherwise the value is zero.
Note: for windows inside Vim use |winnr()|.
Note: for windows inside Vim use |winnr()| or |win_getid()|.
==============================================================================
4. Builtin Functions *functions*
@@ -2322,6 +2330,7 @@ arglistid([{winnr} [, {tabnr}]])
With {winnr} only use this window in the current tab page.
With {winnr} and {tabnr} use the window in the specified tab
page.
{winnr} can be the window number or the window ID.
*argv()*
argv([{nr}]) The result is the {nr}th file in the argument list of the
@@ -3846,8 +3855,8 @@ getchar([expr]) *getchar()*
When the user clicks a mouse button, the mouse event will be
returned. The position can then be found in |v:mouse_col|,
|v:mouse_lnum| and |v:mouse_win|. This example positions the
mouse as it would normally happen: >
|v:mouse_lnum|, |v:mouse_winid| and |v:mouse_win|. This
example positions the mouse as it would normally happen: >
let c = getchar()
if c == "\<LeftMouse>" && v:mouse_win > 0
exe v:mouse_win . "wincmd w"
@@ -3979,6 +3988,7 @@ getcwd([{winnr} [, {tabnr}]])
in the current tab page.
With {winnr} and {tabnr} return the local current directory of
the window in the specified tab page.
{winnr} can be the window number or the window ID.
Return an empty string if the arguments are invalid.
getfsize({fname}) *getfsize()*
@@ -4075,7 +4085,9 @@ getline({lnum} [, {end}])
getloclist({nr}) *getloclist()*
Returns a list with all the entries in the location list for
window {nr}. When {nr} is zero the current window is used.
window {nr}. {nr} can be the window number or the window ID.
When {nr} is zero the current window is used.
For a location list window, the displayed location list is
returned. For an invalid window number {nr}, an empty list is
returned. Otherwise, same as |getqflist()|.
@@ -4209,6 +4221,7 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
Note that {varname} must be the name without "w:".
Tabs are numbered starting with one. For the current tabpage
use |getwinvar()|.
{winnr} can be the window number or the window ID.
When {winnr} is zero the current window is used.
This also works for a global option, buffer-local option and
window-local option, but it doesn't work for a global variable
@@ -4333,6 +4346,7 @@ haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()*
With {winnr} use this window in the current tab page.
With {winnr} and {tabnr} use the window in the specified tab
page.
{winnr} can be the window number or the window ID.
Return 0 if the arguments are invalid.
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
@@ -4724,6 +4738,10 @@ job_status({job}) *job_status()* *E916*
"fail" job failed to start
"dead" job died or was stopped after running
On Unix a non-existing command results in "dead" instead of
"fail", because a fork happens before the failure can be
detected.
If an exit callback was set with the "exit_cb" option and the
job is now detected to be "dead" the callback will be invoked.
@@ -6275,9 +6293,11 @@ setline({lnum}, {text}) *setline()*
setloclist({nr}, {list} [, {action}]) *setloclist()*
Create or replace or add to the location list for window {nr}.
When {nr} is zero the current window is used. For a location
list window, the displayed location list is modified. For an
invalid window number {nr}, -1 is returned.
{nr} can be the window number or the window ID.
When {nr} is zero the current window is used.
For a location list window, the displayed location list is
modified. For an invalid window number {nr}, -1 is returned.
Otherwise, same as |setqflist()|.
Also see |location-list|.
@@ -6369,10 +6389,15 @@ setqflist({list} [, {action}]) *setqflist()*
*E927*
If {action} is set to 'a', then the items from {list} are
added to the existing quickfix list. If there is no existing
list, then a new list is created. If {action} is set to 'r',
then the items from the current quickfix list are replaced
with the items from {list}. If {action} is not present or is
set to ' ', then a new list is created.
list, then a new list is created.
If {action} is set to 'r', then the items from the current
quickfix list are replaced with the items from {list}. This
can also be used to clear the list: >
:call setqflist([], 'r')
<
If {action} is not present or is set to ' ', then a new list
is created.
Returns zero for success, -1 for failure.
@@ -6439,6 +6464,7 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
{val}.
Tabs are numbered starting with one. For the current tabpage
use |setwinvar()|.
{winnr} can be the window number or the window ID.
When {winnr} is zero the current window is used.
This also works for a global or local buffer option, but it
doesn't work for a global or local buffer variable.
@@ -7511,9 +7537,11 @@ win_id2win({expr}) *win_id2win()*
*winbufnr()*
winbufnr({nr}) The result is a Number, which is the number of the buffer
associated with window {nr}. When {nr} is zero, the number of
the buffer in the current window is returned. When window
{nr} doesn't exist, -1 is returned.
associated with window {nr}. {nr} can be the window number or
the window ID.
When {nr} is zero, the number of the buffer in the current
window is returned.
When window {nr} doesn't exist, -1 is returned.
Example: >
:echo "The file in the current window is " . bufname(winbufnr(0))
<
@@ -7524,6 +7552,7 @@ wincol() The result is a Number, which is the virtual column of the
winheight({nr}) *winheight()*
The result is a Number, which is the height of window {nr}.
{nr} can be the window number or the window ID.
When {nr} is zero, the height of the current window is
returned. When window {nr} doesn't exist, -1 is returned.
An existing window always has a height of zero or more.
@@ -7603,6 +7632,7 @@ winsaveview() Returns a |Dictionary| that contains information to restore
winwidth({nr}) *winwidth()*
The result is a Number, which is the width of window {nr}.
{nr} can be the window number or the window ID.
When {nr} is zero, the width of the current window is
returned. When window {nr} doesn't exist, -1 is returned.
An existing window always has a width of zero or more.

View File

@@ -1411,6 +1411,27 @@ The valid escape sequences are
<bang> (See the '-bang' attribute) Expands to a ! if the
command was executed with a ! modifier, otherwise
expands to nothing.
*<mods>*
<mods> The command modifiers, if specified. Otherwise, expands to
nothing. Supported modifiers are |aboveleft|, |belowright|,
|botright|, |browse|, |confirm|, |hide|, |keepalt|,
|keepjumps|, |keepmarks|, |keeppatterns|, |lockmarks|,
|noswapfile|, |silent|, |tab|, |topleft|, |verbose|, and
|vertical|.
Examples: >
command! -nargs=+ -complete=file MyEdit
\ for f in expand(<q-args>, 0, 1) |
\ exe '<mods> split ' . f |
\ endfor
function! SpecialEdit(files, mods)
for f in expand(a:files, 0, 1)
exe a:mods . ' split ' . f
endfor
endfunction
command! -nargs=+ -complete=file Sedit
\ call SpecialEdit(<q-args>, <q-mods>)
<
*<reg>* *<register>*
<reg> (See the '-register' attribute) The optional register,
if specified. Otherwise, expands to nothing. <register>

View File

@@ -1,4 +1,4 @@
*options.txt* For Vim version 7.4. Last change: 2016 May 24
*options.txt* For Vim version 7.4. Last change: 2016 Jun 04
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1103,6 +1103,7 @@ A jump table for the options with a short description can be found at |Q_op|.
v:beval_bufnr number of the buffer in which balloon is going to show
v:beval_winnr number of the window
v:beval_winid ID of the window
v:beval_lnum line number
v:beval_col column number (byte index)
v:beval_text word under or after the mouse pointer

View File

@@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 7.4. Last change: 2016 Mar 23
*quickfix.txt* For Vim version 7.4. Last change: 2016 Jun 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -457,6 +457,9 @@ expression.
The BufWinEnter event is also triggered, again using "quickfix" for the buffer
name.
Note: When adding to an existing quickfix list the autocommand are not
triggered.
Note: Making changes in the quickfix window has no effect on the list of
errors. 'modifiable' is off to avoid making changes. If you delete or insert
lines anyway, the relation between the text and the error number is messed up.

View File

@@ -1,4 +1,4 @@
*syntax.txt* For Vim version 7.4. Last change: 2016 Apr 10
*syntax.txt* For Vim version 7.4. Last change: 2016 May 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4779,6 +4779,10 @@ font={font-name} *highlight-font*
All fonts used, except for Menu and Tooltip, should be of the same
character size as the default font! Otherwise redrawing problems will
occur.
To use a font name with an embedded space or other special character,
put it in single quotes. The single quote cannot be used then.
Example: >
:hi comment font='Monospace 10'
guifg={color-name} *highlight-guifg*
guibg={color-name} *highlight-guibg*

View File

@@ -4916,7 +4916,6 @@ added-win32-GUI version5.txt /*added-win32-GUI*
aff-dic-format spell.txt /*aff-dic-format*
after-directory options.txt /*after-directory*
aleph options.txt /*aleph*
alloc_fail() eval.txt /*alloc_fail()*
alt intro.txt /*alt*
alt-input debugger.txt /*alt-input*
alternate-file editing.txt /*alternate-file*
@@ -5037,6 +5036,7 @@ beval_bufnr-variable eval.txt /*beval_bufnr-variable*
beval_col-variable eval.txt /*beval_col-variable*
beval_lnum-variable eval.txt /*beval_lnum-variable*
beval_text-variable eval.txt /*beval_text-variable*
beval_winid-variable eval.txt /*beval_winid-variable*
beval_winnr-variable eval.txt /*beval_winnr-variable*
bitwise-function usr_41.txt /*bitwise-function*
blockwise-examples visual.txt /*blockwise-examples*
@@ -5069,6 +5069,7 @@ buflisted() eval.txt /*buflisted()*
bufloaded() eval.txt /*bufloaded()*
bufname() eval.txt /*bufname()*
bufnr() eval.txt /*bufnr()*
bufwinid() eval.txt /*bufwinid()*
bufwinnr() eval.txt /*bufwinnr()*
bug-fixes-5 version5.txt /*bug-fixes-5*
bug-fixes-6 version6.txt /*bug-fixes-6*
@@ -5619,7 +5620,6 @@ dip motion.txt /*dip*
dircolors.vim syntax.txt /*dircolors.vim*
dis motion.txt /*dis*
disable-menus gui.txt /*disable-menus*
disable_char_avail_for_testing() eval.txt /*disable_char_avail_for_testing()*
discard editing.txt /*discard*
distribute-script usr_41.txt /*distribute-script*
distribution intro.txt /*distribution*
@@ -7187,6 +7187,7 @@ mouse-using term.txt /*mouse-using*
mouse_col-variable eval.txt /*mouse_col-variable*
mouse_lnum-variable eval.txt /*mouse_lnum-variable*
mouse_win-variable eval.txt /*mouse_win-variable*
mouse_winid-variable eval.txt /*mouse_winid-variable*
movement intro.txt /*movement*
ms-dos os_msdos.txt /*ms-dos*
msdos os_msdos.txt /*msdos*
@@ -8612,6 +8613,8 @@ terminal-options term.txt /*terminal-options*
terminfo term.txt /*terminfo*
termresponse-variable eval.txt /*termresponse-variable*
test-functions usr_41.txt /*test-functions*
test_alloc_fail() eval.txt /*test_alloc_fail()*
test_disable_char_avail() eval.txt /*test_disable_char_avail()*
test_garbagecollect_now() eval.txt /*test_garbagecollect_now()*
test_null_channel() eval.txt /*test_null_channel()*
test_null_dict() eval.txt /*test_null_dict()*
@@ -8761,6 +8764,7 @@ v:beval_bufnr eval.txt /*v:beval_bufnr*
v:beval_col eval.txt /*v:beval_col*
v:beval_lnum eval.txt /*v:beval_lnum*
v:beval_text eval.txt /*v:beval_text*
v:beval_winid eval.txt /*v:beval_winid*
v:beval_winnr eval.txt /*v:beval_winnr*
v:char eval.txt /*v:char*
v:charconvert_from eval.txt /*v:charconvert_from*
@@ -8795,6 +8799,7 @@ v:lnum eval.txt /*v:lnum*
v:mouse_col eval.txt /*v:mouse_col*
v:mouse_lnum eval.txt /*v:mouse_lnum*
v:mouse_win eval.txt /*v:mouse_win*
v:mouse_winid eval.txt /*v:mouse_winid*
v:none eval.txt /*v:none*
v:null eval.txt /*v:null*
v:oldfiles eval.txt /*v:oldfiles*

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.4. Last change: 2016 May 24
*todo.txt* For Vim version 7.4. Last change: 2016 Jun 04
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -34,49 +34,11 @@ not be repeated below, unless there is extra information.
*known-bugs*
-------------------- Known bugs and current work -----------------------
Close_cb crash. (Luc Hermitte, 2016 May 10)
Stack trace by Dominique, May 10.
Reference count in partial dict wrong?
Any other callbacks that could be invoked at the wrong moment?
If removing buffer that's being read from, close channel?
Problem with "Ignore" after adding 'guicolors'. (Charles Campbell, 2016 Apr
27)
In test_partial when start_job() has a non-existing command memory (a dict
item) leaks.
Memory leak in test49
Memory leak in test_alot, with matchstrpos()
Packages:
- Add the "after" directory to 'runtimepath', only if it exists.
(Greg Hurrell, May 1)
- Also keep a list of loaded plugins, skip when encountered again?
Vim.org: when a user already has a homepage, do show the field so that it can
be deleted.
Comparing partials doesn't work well. (Nikolai Pavlov, 2016 May 17, #813)
Examples in the form of a test (May 19)
+channel:
- Feedback from Ramel Eshed, May 7. Occasional crashes.
- Close_cb isn't invoked when output goes to a buffer. (Luc Hermitte)
- close_cb and exit_cb not invoked when using jo_stop() on Windows.
(Linwei, 2016 May 18, #817)
Similar problem, related to keeping reference to job. (Skywind, May 18)
- Recursive callback call? (Luc Hermitte, 2016 May 17)
- GUI:cursor blinking is irregular when invoking callbacks. (Ramel Eshed, 2016
Apr 16) somehow remember the previous state?
- When a message in the queue but there is no callback, drop it after a while?
Add timestamp to queued messages and callbacks with ID, remove after a
minute. Option to set the droptime.
- Inefficiency in ch_read() with very long lines. Reallocating buffer with
small increments in channel_collapse(). Avoid calling strlen() too often.
Add an option to drop text of very long lines? Default to 1 Mbyte.
- Add an option to drop text of very long lines? Default to 1 Mbyte.
- Add remark about undo sync, is there a way to force it?
- When starting a job, have an option to open the server socket, so we know
the port, and pass it to the command with --socket-fd {nr}. (Olaf Dabrunz,
@@ -87,8 +49,6 @@ Later
- job_start(): run job in a newly opened terminal.
With xterm could use -S{pty}.
Make it so that the window ID can be used where currently a window nr is used
Regexp problems:
- Since 7.4.704 the old regex engine fails to match [[:print:]] in 0xf6.
(Manuel Ortega, 2016 Apr 24)
@@ -136,9 +96,11 @@ Regexp problems:
matches the empty string. (Dominique Pelle, 2015 Oct 2, Nov 24)
- Search for \\~ causes error E874.
Using freed memory in quickfix code. (Dominique, 2016 Mar 21)
Patch to reduce number of memory allocations for quickfix lines.
(Yegappan Lakshmanan, 2016 May 22, #831)
User commands: add a <> item to pass on command modifiers, such as ":tab".
Patch by Yegappan Lakshmanan, 2016 May 22, #829.
jsonencode(): should convert to utf-8. (Nikolai Pavlov, 2016 Jan 23)
What if there is an invalid character?
@@ -146,6 +108,13 @@ What if there is an invalid character?
Once .exe with updated installer is available: Add remark to download page
about /S and /D options (Ken Takata, 2016 Apr 13)
Cursor positioned in the wrong place when editing src/testdir/test_viml.vim.
When using "k" at the hit-enter prompt only get the hit-enter prompt, not
scrolling up. (Ramel Eshed, 2016 May 25)
Related patches: Patch 7.4.1603, Patch 7.4.1594
Patch by Hirohito Higashi, 2016 May 26.
Patch to make cursor blinking work better with GTK3. (Kazunobu Kuriyama, 2016
Apr 19) Need to check this works on Linux.
Alternative:
@@ -164,8 +133,8 @@ Invalid behavior with NULL list. (Nikolai Pavlov, #768)
Patch to fix using CTRL-] on "{address}." in help. (Hirohito Higashi, 2016 May
18, #814)
Patch to reduce number of memory allocations for quickfix lines.
(Yegappan Lakshmanan, 2016 May 22, #831)
Can we add a function to parse one line for 'errorformat'? Like ":caddexpr"
for one line.
Patch to fix greying popup menu items. (Shane Harper, 2016 May 23, #834)
@@ -175,8 +144,17 @@ Patch to fix this, Jacob Niehus, 2016 May 14, #805)
For current Windows build .pdb file is missing. (Gabriele Fava, 2016 May 11)
5)
Patch to support expression argument to sort() instead of a function name.
Yasuhiro Matsumoto, 2013 May 31.
Or should we add a more general mechanism, like a lambda() function?
Patch by Yasuhiro Matsumoto, 2014 Sep 16, update 2016 Apr 17.
Correction for test, Ken Takata, 2016 May 27.
Problem with whitespace in errorformat. (Gerd Wachsmuth, 2016 May 15, #807)
Patch to add filtering of the quickfix list. (Yegappan Lakshmanan, 2016 Mar
13, last version) Update May 22, #830.
When 'autochdir' is set, writing new file does not change the current dir.
(Dan Church, issue #777)
Patch to fix this. (mister fish (Allen Haim), 2016 May 14, #803)
@@ -237,6 +215,8 @@ Update 2016 Mar 28. Can include all parts into one dist patch.
Patch to support 64 bit ints for Number. (Ken Takata, 2016 Jan 21)
Update 2016 Apr 24.
Patch to improve cscope. (Adrian Kocis, #843)
Patch for groovy multi-line comment highlighting. (Justin M. Keyes, 2016 May
20 #644)
@@ -284,11 +264,6 @@ Patch to make tests pass with EBCDIC. (Owen Leibman, 2016 Apr 10)
When repeating the 'confirm' dialog one needs to press Enter. (ds26gte, 2016
Apr 17) #762
Patch to support expression argument to sort() instead of a function name.
Yasuhiro Matsumoto, 2013 May 31.
Or should we add a more general mechanism, like a lambda() function?
Patch by Yasuhiro Matsumoto, 2014 Sep 16, update 2016 Apr 17.
Should jsonencode()/jsondecode() restrict recursiveness?
Or avoid recursiveness.
@@ -411,9 +386,6 @@ Patch to add :mapgroup, put mappings in a group like augroup.
Value returned by virtcol() changes depending on how lines wrap. This is
inconsistent with the documentation.
Patch to add filtering of the quickfix list. (Yegappan Lakshmanan, 2016 Mar
13, last version) Update May 22, #830.
Can we cache the syntax attributes, so that updates for 'relativenumber' and
'cursorline'/'cursorcolumn' are a lot faster?
@@ -459,8 +431,6 @@ wildcards. Add a ":nowild" command modifier? (ZyX, 2015 March 4)
Proposal to make options.txt easier to read. (Arnaud Decara, 2015 Aug 5)
Update Aug 14.
Crash in :cnext on MS-Windows. (Ben Fritz, 2015 Oct 27)
When using --remote-tab on MS-Windows 'encoding' hasn't been initialized yet,
the file name ends up encoded wrong. (Raul Coronado, 2015 Dec 21)

View File

@@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 7.4. Last change: 2016 Apr 12
*usr_41.txt* For Vim version 7.4. Last change: 2016 Jun 04
VIM USER MANUAL - by Bram Moolenaar
@@ -786,6 +786,7 @@ Buffers, windows and the argument list:
tabpagenr() get the number of a tab page
tabpagewinnr() like winnr() for a specified tab page
winnr() get the window number for the current window
bufwinid() get the window ID of a specific buffer
bufwinnr() get the window number of a specific buffer
winbufnr() get the buffer number of a specific window
getbufline() get a list of lines from the specified buffer

View File

@@ -1,4 +1,4 @@
*version7.txt* For Vim version 7.4. Last change: 2016 Apr 03
*version7.txt* For Vim version 7.4. Last change: 2016 Jun 04
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@@ -1,4 +1,4 @@
*version8.txt* For Vim version 8.0. Last change: 2016 May 20
*version8.txt* For Vim version 8.0. Last change: 2016 Jun 04
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -102,7 +102,8 @@ New style tests ~
This is for Vim developers. So far writing tests for Vim has not been easy.
Vim 8 adds assert functions and a framework to run tests. This makes it a lot
simpler to write tests and keep them updated.
simpler to write tests and keep them updated. Also new are several functions
that are added specifically for testing.
These functions have been added:
|assert_equal()|
@@ -113,15 +114,22 @@ These functions have been added:
|assert_match()|
|assert_notmatch()|
|assert_true()|
|alloc_fail()|
|disable_char_avail_for_testing()|
|test_alloc_fail()|
|test_disable_char_avail()|
|test_garbagecollect_now()|
|test_null_channel()|
|test_null_dict()|
|test_null_job()|
|test_null_list()|
|test_null_partial()|
|test_null_string()|
Window IDs ~
Previously windows could only be accessed by their number. And every time a
window would open, close or move that number changes. Each window now has a
unique ID, so that they are easy to find.
unique ID, so that they are easy to find. See |win_getid()| and |win_id2win()|.
Wrapping lines with indent ~

View File

@@ -36,10 +36,11 @@ except ImportError:
else:
specfile = vim.current.buffer.name
if specfile:
rpm.delMacro("dist")
spec = rpm.spec(specfile)
headers = spec.packages[0].header
version = headers['Version']
release = ".".join(headers['Release'].split(".")[:-1])
headers = spec.sourceHeader
version = headers["Version"]
release = headers["Release"]
vim.command("let ver = " + version)
vim.command("let rel = " + release)
PYEND
@@ -113,7 +114,10 @@ if !exists("*s:SpecChangelog")
endif
endif
if (chgline != -1)
let tmptime = v:lc_time
language time C
let parsed_format = "* ".strftime(format)." - ".ver."-".rel
execute "language time" tmptime
let release_info = "+ ".name."-".ver."-".rel
let wrong_format = 0
let wrong_release = 0
@@ -179,12 +183,8 @@ if !exists("*s:ParseRpmVars")
endif
let varname = strpart(a:str, start+2, end-(start+2))
execute a:strline
let definestr = "^[ \t]*%define[ \t]\\+" . varname . "[ \t]\\+\\(.*\\)$"
let definestr = "^[ \t]*%(?:global|define)[ \t]\\+" . varname . "[ \t]\\+\\(.*\\)$"
let linenum = search(definestr, "bW")
if (linenum == 0)
let definestr = substitute(definestr, "%define", "%global", "")
let linenum = search(definestr, "bW")
endif
if (linenum != -1)
let ret = ret . substitute(getline(linenum), definestr, "\\1", "")
else
@@ -201,7 +201,7 @@ endif
let b:match_ignorecase = 0
let b:match_words =
\ '^Name:^%description:^%clean:^%setup:^%build:^%install:^%files:' .
\ '^Name:^%description:^%clean:^%(?:auto)?setup:^%build:^%install:^%files:' .
\ '^%package:^%preun:^%postun:^%changelog'
let &cpo = s:cpo_save

View File

@@ -1,8 +1,8 @@
" VHDL indent ('93 syntax)
" Language: VHDL
" Maintainer: Gerald Lai <laigera+vim?gmail.com>
" Version: 1.58
" Last Change: 2011 Sep 27
" Version: 1.60
" Last Change: 2016 Feb 26
" URL: http://www.vim.org/scripts/script.php?script_id=1450
" only load this indent file when no other was loaded
@@ -104,7 +104,7 @@ function GetVHDLindent()
let pn = prevnonblank(pn - 1)
let ps = getline(pn)
endwhile
if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*\%(=>\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)\)') && (prevs =~? s:NC.'\<\%(procedure\s\+\S\+\|generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(procedure\|generic\|map\|port\)'.s:ES && prevs =~ '^\s*('))
if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*\((.*)\)*\s*\%(=>\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\s\+\)\)') && (prevs =~? s:NC.'\<\%(procedure\s\+\S\+\|generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(procedure\|generic\|map\|port\)'.s:ES && prevs =~ '^\s*('))
" align closing ")" with opening "("
if curs =~ '^\s*)'
return ind2 + stridx(prevs_noi, '(')
@@ -412,11 +412,22 @@ function GetVHDLindent()
" ****************************************************************************************
" indent: maintain indent of previous opening statement
" keywords: without "procedure", "generic", "map", "port" + ":" but not ":=" + "in", "out", "inout", "buffer", "linkage", variable & ":="
" keywords: without "procedure", "generic", "map", "port" + ":" but not ":=" + eventually ;$
" where: start of current line
if curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)'
if curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=].*;.*$'
return ind2
endif
" ****************************************************************************************
" indent: maintain indent of previous opening statement, corner case which
" does not end in ;, but is part of a mapping
" keywords: without "procedure", "generic", "map", "port" + ":" but not ":=", never + ;$ and
" prevline without "procedure", "generic", "map", "port" + ":" but not ":=" + eventually ;$
" where: start of current line
if curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=].*[^;].*$'
if prevs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@<!\w\+\s*\w*\s*:[^=].*;.*$'
return ind2
endif
endif
" return leftover filtered indent
return ind

View File

@@ -2,7 +2,7 @@
" Language: BibTeX (bibliographic database format for (La)TeX)
" Maintainer: Bernd Feige <Bernd.Feige@gmx.net>
" Filenames: *.bib
" Last Change: 2014 Mar 26
" Last Change: 2016 May 31
" Thanks to those who pointed out problems with this file or supplied fixes!
@@ -35,8 +35,40 @@ syn keyword bibEntryKw contained crossref edition editor howpublished
syn keyword bibEntryKw contained institution journal key month note
syn keyword bibEntryKw contained number organization pages publisher
syn keyword bibEntryKw contained school series title type volume year
" biblatex keywords, cf. http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf
syn keyword bibType contained mvbook bookinbook suppbook collection mvcollection suppcollection
syn keyword bibType contained online patent periodical suppperiodical mvproceedings reference
syn keyword bibType contained mvreference inreference report set thesis xdata customa customb
syn keyword bibType contained customc customd custome customf electronic www artwork audio bibnote
syn keyword bibType contained commentary image jurisdiction legislation legal letter movie music
syn keyword bibType contained performance review software standard video
syn keyword bibEntryKw contained abstract isbn issn keywords url
syn keyword bibEntryKw contained addendum afterwordannotation annotation annotator authortype
syn keyword bibEntryKw contained bookauthor bookpagination booksubtitle booktitleaddon
syn keyword bibEntryKw contained commentator date doi editora editorb editorc editortype
syn keyword bibEntryKw contained editoratype editorbtype editorctype eid entrysubtype
syn keyword bibEntryKw contained eprint eprintclass eprinttype eventdate eventtitle
syn keyword bibEntryKw contained eventtitleaddon file foreword holder indextitle
syn keyword bibEntryKw contained introduction isan ismn isrn issue issuesubtitle
syn keyword bibEntryKw contained issuetitle iswc journalsubtitle journaltitle label
syn keyword bibEntryKw contained language library location mainsubtitle maintitle
syn keyword bibEntryKw contained maintitleaddon nameaddon origdate origlanguage
syn keyword bibEntryKw contained origlocation origpublisher origtitle pagetotal
syn keyword bibEntryKw contained pagination part pubstate reprinttitle shortauthor
syn keyword bibEntryKw contained shorteditor shorthand shorthandintro shortjournal
syn keyword bibEntryKw contained shortseries shorttitle subtitle titleaddon translator
syn keyword bibEntryKw contained urldate venue version volumes entryset execute gender
syn keyword bibEntryKw contained langid langidopts ids indexsorttitle options presort
syn keyword bibEntryKw contained related relatedoptions relatedtype relatedstring
syn keyword bibEntryKw contained sortkey sortname sortshorthand sorttitle sortyear xdata
syn keyword bibEntryKw contained xref namea nameb namec nameatype namebtype namectype
syn keyword bibEntryKw contained lista listb listc listd liste listf usera userb userc
syn keyword bibEntryKw contained userd usere userf verba verbb verbc archiveprefix pdf
syn keyword bibEntryKw contained primaryclass
" Non-standard:
syn keyword bibNSEntryKw contained abstract isbn issn keywords url
" AMS mref http://www.ams.org/mref
syn keyword bibNSEntryKw contained mrclass mrnumber mrreviewer fjournal coden

View File

@@ -3,7 +3,7 @@
" Language: SPEC: Build/install scripts for Linux RPM packages
" Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com
" Former Maintainer: Donovan Rebbechi elflord@panix.com (until March 2014)
" Last Change: Sun Mar 2 10:33 MSK 2014 Igor Gnatenko
" Last Change: Sat Apr 9 15:30 2016 Filip Szymański
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
@@ -83,8 +83,8 @@ syn keyword specMacroNameLocal contained _arch _binary_payload _bindir _build _b
"One line macros - valid in all ScriptAreas
"tip: remember do include new items on specScriptArea's skip section
syn region specSectionMacroArea oneline matchgroup=specSectionMacro start='^%\(define\|global\|patch\d*\|setup\|configure\|GNUconfigure\|find_lang\|makeinstall\|make_install\|include\)\>' end='$' contains=specCommandOpts,specMacroIdentifier
syn region specSectionMacroBracketArea oneline matchgroup=specSectionMacro start='^%{\(configure\|GNUconfigure\|find_lang\|makeinstall\|make_install\)}' end='$' contains=specCommandOpts,specMacroIdentifier
syn region specSectionMacroArea oneline matchgroup=specSectionMacro start='^%\(define\|global\|patch\d*\|setup\|autosetup\|autopatch\|configure\|GNUconfigure\|find_lang\|make_build\|makeinstall\|make_install\|include\)\>' end='$' contains=specCommandOpts,specMacroIdentifier
syn region specSectionMacroBracketArea oneline matchgroup=specSectionMacro start='^%{\(configure\|GNUconfigure\|find_lang\|make_build\|makeinstall\|make_install\)}' end='$' contains=specCommandOpts,specMacroIdentifier
"%% Files Section %%
"TODO %config valid parameters: missingok\|noreplace
@@ -105,7 +105,7 @@ syn case ignore
"%% PreAmble Section %%
"Copyright and Serial were deprecated by License and Epoch
syn region specPreAmbleDeprecated oneline matchgroup=specError start='^\(Copyright\|Serial\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier
syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Icon\|URL\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier
syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Recommends\|Suggests\|Supplements\|Enhances\|Icon\|URL\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier
"%% Description Section %%
syn region specDescriptionArea matchgroup=specSection start='^%description' end='^%'me=e-1 contains=specDescriptionOpts,specEmail,specURL,specNumber,specMacroIdentifier,specComment
@@ -114,7 +114,7 @@ syn region specDescriptionArea matchgroup=specSection start='^%description' end=
syn region specPackageArea matchgroup=specSection start='^%package' end='^%'me=e-1 contains=specPackageOpts,specPreAmble,specComment
"%% Scripts Section %%
syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|find_lang\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
syn region specScriptArea matchgroup=specSection start='^%\(prep\|build\|install\|clean\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
"%% Changelog Section %%
syn region specChangelogArea matchgroup=specSection start='^%changelog' end='^%'me=e-1 contains=specEmail,specURL,specWeekday,specMonth,specNumber,specComment,specLicense

View File

@@ -11,7 +11,7 @@ Contents:
See INSTALLami.txt for Amiga
See INSTALLmac.txt for Macintosh
See INSTALLpc.txt for PC (MS-DOS, Windows 95/98/NT/XP)
See INSTALLpc.txt for PC (Windows 95/98/NT/XP/Vista/7/8/10)
See INSTALLvms.txt for VMS
See INSTALLx.txt for cross-compiling on Unix
See ../README_390.txt for OS/390 Unix

View File

@@ -2516,7 +2516,7 @@ buflist_findnr(int nr)
nr = curwin->w_alt_fnum;
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_fnum == nr)
return (buf);
return buf;
return NULL;
}

View File

@@ -1549,6 +1549,35 @@ invoke_callback(channel_T *channel, char_u *callback, partial_T *partial,
channel_need_redraw = TRUE;
}
/*
* Return the first node from "channel"/"part" without removing it.
* Returns NULL if there is nothing.
*/
readq_T *
channel_peek(channel_T *channel, int part)
{
readq_T *head = &channel->ch_part[part].ch_head;
return head->rq_next;
}
/*
* Return a pointer to the first NL in "node".
* Skips over NUL characters.
* Returns NULL if there is no NL.
*/
char_u *
channel_first_nl(readq_T *node)
{
char_u *buffer = node->rq_buffer;
long_u i;
for (i = 0; i < node->rq_buflen; ++i)
if (buffer[i] == NL)
return buffer + i;
return NULL;
}
/*
* Return the first buffer from channel "channel"/"part" and remove it.
* The caller must free it.
@@ -1576,6 +1605,7 @@ channel_get(channel_T *channel, int part)
/*
* Returns the whole buffer contents concatenated for "channel"/"part".
* Replaces NUL bytes with NL.
*/
static char_u *
channel_get_all(channel_T *channel, int part)
@@ -1599,7 +1629,7 @@ channel_get_all(channel_T *channel, int part)
p = res;
for (node = head->rq_next; node != NULL; node = node->rq_next)
{
STRCPY(p, node->rq_buffer);
mch_memmove(p, node->rq_buffer, node->rq_buflen);
p += node->rq_buflen;
}
*p = NUL;
@@ -1611,9 +1641,32 @@ channel_get_all(channel_T *channel, int part)
vim_free(p);
} while (p != NULL);
/* turn all NUL into NL */
while (len > 0)
{
--len;
if (res[len] == NUL)
res[len] = NL;
}
return res;
}
/*
* Consume "len" bytes from the head of "channel"/"part".
* Caller must check these bytes are available.
*/
void
channel_consume(channel_T *channel, int part, int len)
{
readq_T *head = &channel->ch_part[part].ch_head;
readq_T *node = head->rq_next;
char_u *buf = node->rq_buffer;
mch_memmove(buf, buf + len, node->rq_buflen - len);
node->rq_buflen -= len;
}
/*
* Collapses the first and second buffer for "channel"/"part".
* Returns FAIL if that is not possible.
@@ -1637,7 +1690,7 @@ channel_collapse(channel_T *channel, int part, int want_nl)
len = node->rq_buflen + last_node->rq_buflen + 1;
if (want_nl)
while (last_node->rq_next != NULL
&& vim_strchr(last_node->rq_buffer, NL) == NULL)
&& channel_first_nl(last_node) == NULL)
{
last_node = last_node->rq_next;
len += last_node->rq_buflen;
@@ -1646,17 +1699,18 @@ channel_collapse(channel_T *channel, int part, int want_nl)
p = newbuf = alloc(len);
if (newbuf == NULL)
return FAIL; /* out of memory */
STRCPY(p, node->rq_buffer);
mch_memmove(p, node->rq_buffer, node->rq_buflen);
p += node->rq_buflen;
vim_free(node->rq_buffer);
node->rq_buffer = newbuf;
for (n = node; n != last_node; )
{
n = n->rq_next;
STRCPY(p, n->rq_buffer);
mch_memmove(p, n->rq_buffer, n->rq_buflen);
p += n->rq_buflen;
vim_free(n->rq_buffer);
}
node->rq_buflen = (long_u)(p - newbuf);
/* dispose of the collapsed nodes and their buffers */
for (n = node->rq_next; n != last_node; )
@@ -1690,6 +1744,8 @@ channel_save(channel_T *channel, int part, char_u *buf, int len,
node = (readq_T *)alloc(sizeof(readq_T));
if (node == NULL)
return FAIL; /* out of memory */
/* A NUL is added at the end, because netbeans code expects that.
* Otherwise a NUL may appear inside the text. */
node->rq_buffer = alloc(len + 1);
if (node->rq_buffer == NULL)
{
@@ -2282,6 +2338,7 @@ may_invoke_callback(channel_T *channel, int part)
char_u *callback = NULL;
partial_T *partial = NULL;
buf_T *buffer = NULL;
char_u *p;
if (channel->ch_nb_close_cb != NULL)
/* this channel is handled elsewhere (netbeans) */
@@ -2374,19 +2431,27 @@ may_invoke_callback(channel_T *channel, int part)
{
char_u *nl;
char_u *buf;
readq_T *node;
/* See if we have a message ending in NL in the first buffer. If
* not try to concatenate the first and the second buffer. */
while (TRUE)
{
buf = channel_peek(channel, part);
nl = vim_strchr(buf, NL);
node = channel_peek(channel, part);
nl = channel_first_nl(node);
if (nl != NULL)
break;
if (channel_collapse(channel, part, TRUE) == FAIL)
return FALSE; /* incomplete message */
}
if (nl[1] == NUL)
buf = node->rq_buffer;
/* Convert NUL to NL, the internal representation. */
for (p = buf; p < nl && p < buf + node->rq_buflen; ++p)
if (*p == NUL)
*p = NL;
if (nl + 1 == buf + node->rq_buflen)
{
/* get the whole buffer, drop the NL */
msg = channel_get(channel, part);
@@ -2394,16 +2459,19 @@ may_invoke_callback(channel_T *channel, int part)
}
else
{
/* Copy the message into allocated memory and remove it from
* the buffer. */
/* Copy the message into allocated memory (excluding the NL)
* and remove it from the buffer (including the NL). */
msg = vim_strnsave(buf, (int)(nl - buf));
mch_memmove(buf, nl + 1, STRLEN(nl + 1) + 1);
channel_consume(channel, part, (int)(nl - buf) + 1);
}
}
else
{
/* For a raw channel we don't know where the message ends, just
* get everything we have. */
* get everything we have.
* Convert NUL to NL, the internal representation. */
msg = channel_get_all(channel, part);
}
if (msg == NULL)
return FALSE; /* out of memory (and avoids Coverity warning) */
@@ -2666,20 +2734,6 @@ channel_close(channel_T *channel, int invoke_close_cb)
channel->ch_nb_close_cb = NULL;
}
/*
* Return the first buffer from "channel"/"part" without removing it.
* Returns NULL if there is nothing.
*/
char_u *
channel_peek(channel_T *channel, int part)
{
readq_T *head = &channel->ch_part[part].ch_head;
if (head->rq_next == NULL)
return NULL;
return head->rq_next->rq_buffer;
}
/*
* Clear the read buffer on "channel"/"part".
*/
@@ -3042,19 +3096,23 @@ channel_read_block(channel_T *channel, int part, int timeout)
ch_mode_T mode = channel->ch_part[part].ch_mode;
sock_T fd = channel->ch_part[part].ch_fd;
char_u *nl;
readq_T *node;
ch_logsn(channel, "Blocking %s read, timeout: %d msec",
mode == MODE_RAW ? "RAW" : "NL", timeout);
while (TRUE)
{
buf = channel_peek(channel, part);
if (buf != NULL && (mode == MODE_RAW
|| (mode == MODE_NL && vim_strchr(buf, NL) != NULL)))
break;
if (buf != NULL && channel_collapse(channel, part, mode == MODE_NL)
== OK)
continue;
node = channel_peek(channel, part);
if (node != NULL)
{
if (mode == MODE_RAW || (mode == MODE_NL
&& channel_first_nl(node) != NULL))
/* got a complete message */
break;
if (channel_collapse(channel, part, mode == MODE_NL) == OK)
continue;
}
/* Wait for up to the channel timeout. */
if (fd == INVALID_FD)
@@ -3073,8 +3131,17 @@ channel_read_block(channel_T *channel, int part, int timeout)
}
else
{
nl = vim_strchr(buf, NL);
if (nl[1] == NUL)
char_u *p;
buf = node->rq_buffer;
nl = channel_first_nl(node);
/* Convert NUL to NL, the internal representation. */
for (p = buf; p < nl && p < buf + node->rq_buflen; ++p)
if (*p == NUL)
*p = NL;
if (nl + 1 == buf + node->rq_buflen)
{
/* get the whole buffer */
msg = channel_get(channel, part);
@@ -3085,7 +3152,7 @@ channel_read_block(channel_T *channel, int part, int timeout)
/* Copy the message into allocated memory and remove it from the
* buffer. */
msg = vim_strnsave(buf, (int)(nl - buf));
mch_memmove(buf, nl + 1, STRLEN(nl + 1) + 1);
channel_consume(channel, part, (int)(nl - buf) + 1);
}
}
if (log_fd != NULL)

View File

@@ -75,9 +75,6 @@ RUBY_PRO = @RUBY_PRO@
RUBY_CFLAGS = @RUBY_CFLAGS@
RUBY_LIBS = @RUBY_LIBS@
SNIFF_SRC = @SNIFF_SRC@
SNIFF_OBJ = @SNIFF_OBJ@
AWK = @AWK@
STRIP = @STRIP@

View File

@@ -359,6 +359,7 @@ static struct vimvar
{VV_NAME("swapcommand", VAR_STRING), VV_RO},
{VV_NAME("char", VAR_STRING), 0},
{VV_NAME("mouse_win", VAR_NUMBER), 0},
{VV_NAME("mouse_winid", VAR_NUMBER), 0},
{VV_NAME("mouse_lnum", VAR_NUMBER), 0},
{VV_NAME("mouse_col", VAR_NUMBER), 0},
{VV_NAME("operator", VAR_STRING), VV_RO},
@@ -819,6 +820,7 @@ static void f_test_null_job(typval_T *argvars, typval_T *rettv);
static void f_test_null_list(typval_T *argvars, typval_T *rettv);
static void f_test_null_partial(typval_T *argvars, typval_T *rettv);
static void f_test_null_string(typval_T *argvars, typval_T *rettv);
static void f_test_settime(typval_T *argvars, typval_T *rettv);
#ifdef FEAT_FLOAT
static void f_tan(typval_T *argvars, typval_T *rettv);
static void f_tanh(typval_T *argvars, typval_T *rettv);
@@ -8808,13 +8810,14 @@ static struct fst
#ifdef FEAT_JOB_CHANNEL
{"test_null_channel", 0, 0, f_test_null_channel},
#endif
{"test_null_dict", 0, 0, f_test_null_dict},
{"test_null_dict", 0, 0, f_test_null_dict},
#ifdef FEAT_JOB_CHANNEL
{"test_null_job", 0, 0, f_test_null_job},
{"test_null_job", 0, 0, f_test_null_job},
#endif
{"test_null_list", 0, 0, f_test_null_list},
{"test_null_list", 0, 0, f_test_null_list},
{"test_null_partial", 0, 0, f_test_null_partial},
{"test_null_string", 0, 0, f_test_null_string},
{"test_settime", 1, 1, f_test_settime},
#ifdef FEAT_TIMERS
{"timer_start", 2, 3, f_timer_start},
{"timer_stop", 1, 1, f_timer_stop},
@@ -12755,6 +12758,7 @@ f_getchar(typval_T *argvars, typval_T *rettv)
--allow_keys;
vimvars[VV_MOUSE_WIN].vv_nr = 0;
vimvars[VV_MOUSE_WINID].vv_nr = 0;
vimvars[VV_MOUSE_LNUM].vv_nr = 0;
vimvars[VV_MOUSE_COL].vv_nr = 0;
@@ -12810,6 +12814,7 @@ f_getchar(typval_T *argvars, typval_T *rettv)
++winnr;
# endif
vimvars[VV_MOUSE_WIN].vv_nr = winnr;
vimvars[VV_MOUSE_WINID].vv_nr = win->w_id;
vimvars[VV_MOUSE_LNUM].vv_nr = lnum;
vimvars[VV_MOUSE_COL].vv_nr = col + 1;
}
@@ -13563,11 +13568,18 @@ find_win_by_nr(
for (wp = (tp == NULL || tp == curtab) ? firstwin : tp->tp_firstwin;
wp != NULL; wp = wp->w_next)
if (--nr <= 0)
if (nr >= LOWEST_WIN_ID)
{
if (wp->w_id == nr)
return wp;
}
else if (--nr <= 0)
break;
if (nr >= LOWEST_WIN_ID)
return NULL;
return wp;
#else
if (nr == 0 || nr == 1)
if (nr == 0 || nr == 1 || nr == curwin->w_id)
return curwin;
return NULL;
#endif
@@ -20839,7 +20851,7 @@ f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
#ifdef FEAT_JOB_CHANNEL
static void
f_test_null_channel(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
f_test_null_channel(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->v_type = VAR_CHANNEL;
rettv->vval.v_channel = NULL;
@@ -20847,7 +20859,7 @@ f_test_null_channel(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
#endif
static void
f_test_null_dict(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
f_test_null_dict(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = NULL;
@@ -20855,7 +20867,7 @@ f_test_null_dict(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
#ifdef FEAT_JOB_CHANNEL
static void
f_test_null_job(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
f_test_null_job(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->v_type = VAR_JOB;
rettv->vval.v_job = NULL;
@@ -20863,26 +20875,32 @@ f_test_null_job(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
#endif
static void
f_test_null_list(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
f_test_null_list(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->v_type = VAR_LIST;
rettv->vval.v_list = NULL;
}
static void
f_test_null_partial(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
f_test_null_partial(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->v_type = VAR_PARTIAL;
rettv->vval.v_partial = NULL;
}
static void
f_test_null_string(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
f_test_null_string(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
}
static void
f_test_settime(typval_T *argvars, typval_T *rettv UNUSED)
{
time_for_testing = (time_t)get_tv_number(&argvars[0]);
}
#if defined(FEAT_JOB_CHANNEL) || defined(FEAT_TIMERS) || defined(PROTO)
/*
* Get a callback from "arg". It can be a Funcref or a function name.

View File

@@ -1750,9 +1750,14 @@ append_redir(
#if defined(FEAT_VIMINFO) || defined(PROTO)
static int no_viminfo(void);
static int read_viminfo_barline(vir_T *virp, int got_encoding, int writing);
static void write_viminfo_version(FILE *fp_out);
static void write_viminfo_barlines(vir_T *virp, FILE *fp_out);
static int viminfo_errcnt;
#define VIMINFO_VERSION 2
#define VIMINFO_VERSION_WITH_HISTORY 2
static int
no_viminfo(void)
{
@@ -2156,6 +2161,7 @@ do_viminfo(FILE *fp_in, FILE *fp_out, int flags)
vir.vir_conv.vc_type = CONV_NONE;
#endif
ga_init2(&vir.vir_barlines, (int)sizeof(char_u *), 100);
vir.vir_version = -1;
if (fp_in != NULL)
{
@@ -2177,6 +2183,7 @@ do_viminfo(FILE *fp_in, FILE *fp_out, int flags)
fprintf(fp_out, _("# This viminfo file was generated by Vim %s.\n"),
VIM_VERSION_MEDIUM);
fputs(_("# You may edit it if you're careful!\n\n"), fp_out);
write_viminfo_version(fp_out);
#ifdef FEAT_MBYTE
fputs(_("# Value of 'encoding' when this file was written\n"), fp_out);
fprintf(fp_out, "*encoding=%s\n\n", p_enc);
@@ -2220,6 +2227,7 @@ read_viminfo_up_to_marks(
{
int eof;
buf_T *buf;
int got_encoding = FALSE;
#ifdef FEAT_CMDHIST
prepare_viminfo_history(forceit ? 9999 : 0, writing);
@@ -2240,12 +2248,11 @@ read_viminfo_up_to_marks(
case '#':
eof = viminfo_readline(virp);
break;
case '|': /* copy line (for future use) */
if (writing)
ga_add_string(&virp->vir_barlines, virp->vir_line);
eof = viminfo_readline(virp);
case '|':
eof = read_viminfo_barline(virp, got_encoding, writing);
break;
case '*': /* "*encoding=value" */
got_encoding = TRUE;
eof = viminfo_encoding(virp);
break;
case '!': /* global variable */
@@ -2274,10 +2281,13 @@ read_viminfo_up_to_marks(
case '=':
case '@':
#ifdef FEAT_CMDHIST
eof = read_viminfo_history(virp, writing);
#else
eof = viminfo_readline(virp);
/* When history is in bar lines skip the old style history
* lines. */
if (virp->vir_version < VIMINFO_VERSION_WITH_HISTORY)
eof = read_viminfo_history(virp, writing);
else
#endif
eof = viminfo_readline(virp);
break;
case '-':
case '\'':
@@ -2347,8 +2357,8 @@ viminfo_readline(vir_T *virp)
}
/*
* check string read from viminfo file
* remove '\n' at the end of the line
* Check string read from viminfo file.
* Remove '\n' at the end of the line.
* - replace CTRL-V CTRL-V with CTRL-V
* - replace CTRL-V 'n' with '\n'
*
@@ -2463,6 +2473,283 @@ viminfo_writestring(FILE *fd, char_u *p)
putc('\n', fd);
}
/*
* Write a string in quotes that barline_parse() can read back.
* Breaks the line in less than LSIZE pieces when needed.
* Returns remaining characters in the line.
*/
int
barline_writestring(FILE *fd, char_u *s, int remaining_start)
{
char_u *p;
int remaining = remaining_start;
int len = 2;
/* Count the number of characters produced, including quotes. */
for (p = s; *p != NUL; ++p)
{
if (*p == NL)
len += 2;
else if (*p == '"' || *p == '\\')
len += 2;
else
++len;
}
if (len > remaining)
{
fprintf(fd, ">%d\n|<", len);
remaining = LSIZE - 20;
}
putc('"', fd);
for (p = s; *p != NUL; ++p)
{
if (*p == NL)
{
putc('\\', fd);
putc('n', fd);
--remaining;
}
else if (*p == '"' || *p == '\\')
{
putc('\\', fd);
putc(*p, fd);
--remaining;
}
else
putc(*p, fd);
--remaining;
if (remaining < 3)
{
putc('\n', fd);
putc('|', fd);
putc('<', fd);
/* Leave enough space for another continuation. */
remaining = LSIZE - 20;
}
}
putc('"', fd);
return remaining;
}
/*
* Parse a viminfo line starting with '|'.
* Put each decoded value in "values" and return the number of values found.
*/
static int
barline_parse(vir_T *virp, char_u *text, bval_T *values)
{
char_u *p = text;
char_u *nextp = NULL;
char_u *buf = NULL;
int count = 0;
int i;
int allocated = FALSE;
while (*p == ',')
{
if (count == BVAL_MAX)
{
EMSG2(e_intern2, "barline_parse()");
break;
}
++p;
if (*p == '>')
{
/* Need to read a continuation line. Need to put strings in
* allocated memory, because virp->vir_line is overwritten. */
if (!allocated)
{
for (i = 0; i < count; ++i)
if (values[i].bv_type == BVAL_STRING)
{
values[i].bv_string = vim_strnsave(
values[i].bv_string, values[i].bv_len);
values[i].bv_allocated = TRUE;
}
allocated = TRUE;
}
if (vim_isdigit(p[1]))
{
size_t len;
size_t todo;
size_t n;
/* String value was split into lines that are each shorter
* than LSIZE:
* |{bartype},>{length of "{text}{text2}"}
* |<"{text1}
* |<{text2}",{value}
*/
++p;
len = getdigits(&p);
buf = alloc((int)(len + 1));
p = buf;
for (todo = len; todo > 0; todo -= n)
{
if (viminfo_readline(virp) || virp->vir_line[0] != '|'
|| virp->vir_line[1] != '<')
/* file was truncated or garbled */
return 0;
/* Get length of text, excluding |< and NL chars. */
n = STRLEN(virp->vir_line);
while (n > 0 && (virp->vir_line[n - 1] == NL
|| virp->vir_line[n - 1] == CAR))
--n;
n -= 2;
if (n > todo)
{
/* more values follow after the string */
nextp = virp->vir_line + 2 + todo;
n = todo;
}
mch_memmove(p, virp->vir_line + 2, n);
p += n;
}
*p = NUL;
p = buf;
}
else
{
/* Line ending in ">" continues in the next line:
* |{bartype},{lots of values},>
* |<{value},{value}
*/
if (viminfo_readline(virp) || virp->vir_line[0] != '|'
|| virp->vir_line[1] != '<')
/* file was truncated or garbled */
return 0;
p = virp->vir_line + 2;
}
}
if (isdigit(*p))
{
values[count].bv_type = BVAL_NR;
values[count].bv_nr = getdigits(&p);
++count;
}
else if (*p == '"')
{
int len = 0;
char_u *s = p;
/* Unescape special characters in-place. */
++p;
while (*p != '"')
{
if (*p == NL || *p == NUL)
return count; /* syntax error, drop the value */
if (*p == '\\')
{
++p;
if (*p == 'n')
s[len++] = '\n';
else
s[len++] = *p;
++p;
}
else
s[len++] = *p++;
}
s[len] = NUL;
if (s != buf && allocated)
s = vim_strsave(s);
values[count].bv_string = s;
values[count].bv_type = BVAL_STRING;
values[count].bv_len = len;
values[count].bv_allocated = allocated;
++count;
if (nextp != NULL)
{
/* values following a long string */
p = nextp;
nextp = NULL;
}
}
else if (*p == ',')
{
values[count].bv_type = BVAL_EMPTY;
++count;
}
else
break;
}
return count;
}
static int
read_viminfo_barline(vir_T *virp, int got_encoding, int writing)
{
char_u *p = virp->vir_line + 1;
int bartype;
bval_T values[BVAL_MAX];
int count = 0;
int i;
/* The format is: |{bartype},{value},...
* For a very long string:
* |{bartype},>{length of "{text}{text2}"}
* |<{text1}
* |<{text2},{value}
* For a long line not using a string
* |{bartype},{lots of values},>
* |<{value},{value}
*/
if (*p == '<')
{
/* Continuation line of an unrecognized item. */
if (writing)
ga_add_string(&virp->vir_barlines, virp->vir_line);
}
else
{
bartype = getdigits(&p);
switch (bartype)
{
case BARTYPE_VERSION:
/* Only use the version when it comes before the encoding.
* If it comes later it was copied by a Vim version that
* doesn't understand the version. */
if (!got_encoding)
{
count = barline_parse(virp, p, values);
if (count > 0 && values[0].bv_type == BVAL_NR)
virp->vir_version = values[0].bv_nr;
}
break;
case BARTYPE_HISTORY:
count = barline_parse(virp, p, values);
handle_viminfo_history(values, count, writing);
break;
default:
/* copy unrecognized line (for future use) */
if (writing)
ga_add_string(&virp->vir_barlines, virp->vir_line);
}
}
for (i = 0; i < count; ++i)
if (values[i].bv_type == BVAL_STRING && values[i].bv_allocated)
vim_free(values[i].bv_string);
return viminfo_readline(virp);
}
static void
write_viminfo_version(FILE *fp_out)
{
fprintf(fp_out, "# Viminfo version\n|%d,%d\n\n",
BARTYPE_VERSION, VIMINFO_VERSION);
}
static void
write_viminfo_barlines(vir_T *virp, FILE *fp_out)
{
@@ -6216,6 +6503,9 @@ find_help_tags(
*/
if (*s == '\'' && s > arg && *arg == '\'')
break;
/* Also '{' and '}'. */
if (*s == '}' && s > arg && *arg == '{')
break;
}
*d = NUL;

View File

@@ -2139,7 +2139,8 @@ do_one_cmd(
#endif
}
ea.cmd = skipwhite(ea.cmd);
lnum = get_address(&ea, &ea.cmd, ea.addr_type, ea.skip, ea.addr_count == 0);
lnum = get_address(&ea, &ea.cmd, ea.addr_type, ea.skip,
ea.addr_count == 0);
if (ea.cmd == NULL) /* error detected */
goto doend;
if (lnum == MAXLNUM)
@@ -6412,6 +6413,26 @@ uc_split_args(char_u *arg, size_t *lenp)
return buf;
}
static size_t
add_cmd_modifier(char_u *buf, char *mod_str, int *multi_mods)
{
size_t result;
result = STRLEN(mod_str);
if (*multi_mods)
result += 1;
if (buf != NULL)
{
if (*multi_mods)
STRCAT(buf, " ");
STRCAT(buf, mod_str);
}
*multi_mods = 1;
return result;
}
/*
* Check for a <> code in a user command.
* "code" points to the '<'. "len" the length of the <> (inclusive).
@@ -6435,8 +6456,8 @@ uc_check_code(
char_u *p = code + 1;
size_t l = len - 2;
int quote = 0;
enum { ct_ARGS, ct_BANG, ct_COUNT, ct_LINE1, ct_LINE2, ct_REGISTER,
ct_LT, ct_NONE } type = ct_NONE;
enum { ct_ARGS, ct_BANG, ct_COUNT, ct_LINE1, ct_LINE2, ct_MODS,
ct_REGISTER, ct_LT, ct_NONE } type = ct_NONE;
if ((vim_strchr((char_u *)"qQfF", *p) != NULL) && p[1] == '-')
{
@@ -6462,6 +6483,8 @@ uc_check_code(
type = ct_LT;
else if (STRNICMP(p, "reg>", l) == 0 || STRNICMP(p, "register>", l) == 0)
type = ct_REGISTER;
else if (STRNICMP(p, "mods>", l) == 0)
type = ct_MODS;
switch (type)
{
@@ -6585,6 +6608,90 @@ uc_check_code(
break;
}
case ct_MODS:
{
int multi_mods = 0;
typedef struct {
int *varp;
char *name;
} mod_entry_T;
static mod_entry_T mod_entries[] = {
#ifdef FEAT_BROWSE_CMD
{&cmdmod.browse, "browse"},
#endif
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
{&cmdmod.confirm, "confirm"},
#endif
{&cmdmod.hide, "hide"},
{&cmdmod.keepalt, "keepalt"},
{&cmdmod.keepjumps, "keepjumps"},
{&cmdmod.keepmarks, "keepmarks"},
{&cmdmod.keeppatterns, "keeppatterns"},
{&cmdmod.lockmarks, "lockmarks"},
{&cmdmod.noswapfile, "noswapfile"},
{NULL, NULL}
};
int i;
result = quote ? 2 : 0;
if (buf != NULL)
{
if (quote)
*buf++ = '"';
*buf = '\0';
}
#ifdef FEAT_WINDOWS
/* :aboveleft and :leftabove */
if (cmdmod.split & WSP_ABOVE)
result += add_cmd_modifier(buf, "aboveleft", &multi_mods);
/* :belowright and :rightbelow */
if (cmdmod.split & WSP_BELOW)
result += add_cmd_modifier(buf, "belowright", &multi_mods);
/* :botright */
if (cmdmod.split & WSP_BOT)
result += add_cmd_modifier(buf, "botright", &multi_mods);
#endif
/* the modifiers that are simple flags */
for (i = 0; mod_entries[i].varp != NULL; ++i)
if (*mod_entries[i].varp)
result += add_cmd_modifier(buf, mod_entries[i].name,
&multi_mods);
/* TODO: How to support :noautocmd? */
#ifdef HAVE_SANDBOX
/* TODO: How to support :sandbox?*/
#endif
/* :silent */
if (msg_silent > 0)
result += add_cmd_modifier(buf,
emsg_silent > 0 ? "silent!" : "silent", &multi_mods);
#ifdef FEAT_WINDOWS
/* :tab */
if (cmdmod.tab > 0)
result += add_cmd_modifier(buf, "tab", &multi_mods);
/* :topleft */
if (cmdmod.split & WSP_TOP)
result += add_cmd_modifier(buf, "topleft", &multi_mods);
#endif
/* TODO: How to support :unsilent?*/
/* :verbose */
if (p_verbose > 0)
result += add_cmd_modifier(buf, "verbose", &multi_mods);
#ifdef FEAT_WINDOWS
/* :vertical */
if (cmdmod.split & WSP_VERT)
result += add_cmd_modifier(buf, "vertical", &multi_mods);
#endif
if (quote && buf != NULL)
{
buf += result - 2;
*buf = '"';
}
break;
}
case ct_REGISTER:
result = eap->regname ? 1 : 0;
if (quote)

View File

@@ -58,6 +58,7 @@ typedef struct hist_entry
int hisnum; /* identifying number */
int viminfo; /* when TRUE hisstr comes from viminfo */
char_u *hisstr; /* actual entry, separator char after the NUL */
time_t time_set; /* when it was typed, zero if unknown */
} histentry_T;
static histentry_T *(history[HIST_COUNT]) = {NULL, NULL, NULL, NULL, NULL};
@@ -5407,6 +5408,20 @@ static char *(history_names[]) =
NULL
};
/*
* Return the current time in seconds. Calls time(), unless test_settime()
* was used.
*/
static time_t
vim_time(void)
{
#ifdef FEAT_EVAL
return time_for_testing == 0 ? time(NULL) : time_for_testing;
#else
return time(NULL);
#endif
}
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
/*
* Function given to ExpandGeneric() to obtain the possible first
@@ -5576,6 +5591,7 @@ in_history(
history[type][i].hisnum = ++hisnum[type];
history[type][i].viminfo = FALSE;
history[type][i].hisstr = str;
history[type][i].time_set = vim_time();
return TRUE;
}
return FALSE;
@@ -5663,6 +5679,7 @@ add_to_history(
hisptr->hisnum = ++hisnum[histype];
hisptr->viminfo = FALSE;
hisptr->time_set = vim_time();
if (histype == HIST_SEARCH && in_map)
last_maptick = maptick;
}
@@ -6131,9 +6148,10 @@ ex_history(exarg_T *eap)
/*
* Buffers for history read from a viminfo file. Only valid while reading.
*/
static char_u **viminfo_history[HIST_COUNT] = {NULL, NULL, NULL, NULL};
static int viminfo_hisidx[HIST_COUNT] = {0, 0, 0, 0};
static int viminfo_hislen[HIST_COUNT] = {0, 0, 0, 0};
static histentry_T *viminfo_history[HIST_COUNT] =
{NULL, NULL, NULL, NULL, NULL};
static int viminfo_hisidx[HIST_COUNT] = {0, 0, 0, 0, 0};
static int viminfo_hislen[HIST_COUNT] = {0, 0, 0, 0, 0};
static int viminfo_add_at_front = FALSE;
static int hist_type2char(int type, int use_question);
@@ -6191,8 +6209,8 @@ prepare_viminfo_history(int asklen, int writing)
if (len <= 0)
viminfo_history[type] = NULL;
else
viminfo_history[type] =
(char_u **)lalloc((long_u)(len * sizeof(char_u *)), FALSE);
viminfo_history[type] = (histentry_T *)lalloc(
(long_u)(len * sizeof(histentry_T)), FALSE);
if (viminfo_history[type] == NULL)
len = 0;
viminfo_hislen[type] = len;
@@ -6242,7 +6260,9 @@ read_viminfo_history(vir_T *virp, int writing)
mch_memmove(p, val, (size_t)len + 1);
p[len + 1] = NUL;
}
viminfo_history[type][viminfo_hisidx[type]++] = p;
viminfo_history[type][viminfo_hisidx[type]].hisstr = p;
viminfo_history[type][viminfo_hisidx[type]].time_set = 0;
viminfo_hisidx[type]++;
}
}
}
@@ -6251,6 +6271,81 @@ read_viminfo_history(vir_T *virp, int writing)
return viminfo_readline(virp);
}
/*
* Accept a new style history line from the viminfo, store it in the history
* array when it's new.
*/
void
handle_viminfo_history(
bval_T *values,
int count,
int writing)
{
int type;
long_u len;
char_u *val;
char_u *p;
/* Check the format:
* |{bartype},{histtype},{timestamp},{separator},"text" */
if (count < 4
|| values[0].bv_type != BVAL_NR
|| values[1].bv_type != BVAL_NR
|| (values[2].bv_type != BVAL_NR && values[2].bv_type != BVAL_EMPTY)
|| values[3].bv_type != BVAL_STRING)
return;
type = values[0].bv_nr;
if (type >= HIST_COUNT)
return;
if (viminfo_hisidx[type] < viminfo_hislen[type])
{
val = values[3].bv_string;
if (val != NULL && *val != NUL)
{
int sep = type == HIST_SEARCH && values[2].bv_type == BVAL_NR
? values[2].bv_nr : NUL;
int idx;
int overwrite = FALSE;
if (!in_history(type, val, viminfo_add_at_front, sep, writing))
{
/* If lines were written by an older Vim we need to avoid
* getting duplicates. See if the entry already exists. */
for (idx = 0; idx < viminfo_hisidx[type]; ++idx)
{
p = viminfo_history[type][idx].hisstr;
if (STRCMP(val, p) == 0
&& (type != HIST_SEARCH || sep == p[STRLEN(p) + 1]))
{
overwrite = TRUE;
break;
}
}
if (!overwrite)
{
/* Need to re-allocate to append the separator byte. */
len = values[3].bv_len;
p = lalloc(len + 2, TRUE);
}
if (p != NULL)
{
viminfo_history[type][idx].time_set = values[1].bv_nr;
if (!overwrite)
{
mch_memmove(p, val, (size_t)len + 1);
/* Put the separator after the NUL. */
p[len + 1] = sep;
viminfo_history[type][idx].hisstr = p;
viminfo_hisidx[type]++;
}
}
}
}
}
}
/*
* Finish reading history lines from viminfo. Not used when writing viminfo.
*/
@@ -6290,8 +6385,9 @@ finish_viminfo_history(void)
for (i = 0; i < viminfo_hisidx[type]; i++)
{
vim_free(history[type][idx].hisstr);
history[type][idx].hisstr = viminfo_history[type][i];
history[type][idx].hisstr = viminfo_history[type][i].hisstr;
history[type][idx].viminfo = TRUE;
history[type][idx].time_set = viminfo_history[type][i].time_set;
if (--idx < 0)
idx = hislen - 1;
}
@@ -6315,15 +6411,11 @@ finish_viminfo_history(void)
* When "merge" is FALSE just write all history lines. Used for ":wviminfo!".
*/
void
write_viminfo_history(
FILE *fp,
int merge)
write_viminfo_history(FILE *fp, int merge)
{
int i;
int type;
int num_saved;
char_u *p;
int c;
int round;
init_history();
@@ -6339,8 +6431,9 @@ write_viminfo_history(
fprintf(fp, _("\n# %s History (newest to oldest):\n"),
type == HIST_CMD ? _("Command Line") :
type == HIST_SEARCH ? _("Search String") :
type == HIST_EXPR ? _("Expression") :
_("Input Line"));
type == HIST_EXPR ? _("Expression") :
type == HIST_INPUT ? _("Input Line") :
_("Debug Line"));
if (num_saved > hislen)
num_saved = hislen;
@@ -6364,9 +6457,23 @@ write_viminfo_history(
while (num_saved > 0
&& !(round == 2 && i >= viminfo_hisidx[type]))
{
p = round == 1 ? history[type][i].hisstr
: viminfo_history[type] == NULL ? NULL
: viminfo_history[type][i];
char_u *p;
time_t timestamp;
int c = NUL;
if (round == 1)
{
p = history[type][i].hisstr;
timestamp = history[type][i].time_set;
}
else
{
p = viminfo_history[type] == NULL ? NULL
: viminfo_history[type][i].hisstr;
timestamp = viminfo_history[type] == NULL ? 0
: viminfo_history[type][i].time_set;
}
if (p != NULL && (round == 2
|| !merge
|| !history[type][i].viminfo))
@@ -6381,6 +6488,21 @@ write_viminfo_history(
putc(c == NUL ? ' ' : c, fp);
}
viminfo_writestring(fp, p);
{
char cbuf[NUMBUFLEN];
/* New style history with a bar line. Format:
* |{bartype},{histtype},{timestamp},{separator},"text" */
if (c == NUL)
cbuf[0] = NUL;
else
sprintf(cbuf, "%d", c);
fprintf(fp, "|%d,%d,%ld,%s,", BARTYPE_HISTORY,
type, (long)timestamp, cbuf);
barline_writestring(fp, p, LSIZE - 20);
putc('\n', fp);
}
}
if (round == 1)
{
@@ -6400,7 +6522,7 @@ write_viminfo_history(
}
for (i = 0; i < viminfo_hisidx[type]; ++i)
if (viminfo_history[type] != NULL)
vim_free(viminfo_history[type][i]);
vim_free(viminfo_history[type][i].hisstr);
vim_free(viminfo_history[type]);
viminfo_history[type] = NULL;
viminfo_hisidx[type] = 0;

View File

@@ -79,7 +79,7 @@ static mapblock_T *first_abbr = NULL; /* first entry in abbrlist */
static int KeyNoremap = 0; /* remapping flags */
/*
* variables used by vgetorpeek() and flush_buffers()
* Variables used by vgetorpeek() and flush_buffers().
*
* typebuf.tb_buf[] contains all characters that are not consumed yet.
* typebuf.tb_buf[typebuf.tb_off] is the first valid character.

View File

@@ -1639,6 +1639,10 @@ EXTERN int in_free_unref_items INIT(= FALSE);
EXTERN int did_add_timer INIT(= FALSE);
#endif
#ifdef FEAT_EVAL
EXTERN time_t time_for_testing INIT(= 0);
#endif
/*
* Optional Farsi support. Include it here, so EXTERN and INIT are defined.
*/

View File

@@ -657,7 +657,7 @@ gui_gtk3_should_draw_cursor(void)
}
static gboolean
draw_event(GtkWidget *widget,
draw_event(GtkWidget *widget UNUSED,
cairo_t *cr,
gpointer user_data UNUSED)
{
@@ -675,8 +675,6 @@ draw_event(GtkWidget *widget,
{
cairo_rectangle_list_t *list = NULL;
gui_gtk_window_clear(gtk_widget_get_window(widget));
list = cairo_copy_clip_rectangle_list(cr);
if (list->status != CAIRO_STATUS_CLIP_NOT_REPRESENTABLE)
{
@@ -684,6 +682,10 @@ draw_event(GtkWidget *widget,
for (i = 0; i < list->num_rectangles; i++)
{
const cairo_rectangle_t rect = list->rectangles[i];
gui_mch_clear_block(Y_2_ROW(rect.y), 1,
Y_2_ROW(rect.y + rect.height - 1), Columns);
if (blink_mode)
gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height);
else

View File

@@ -7026,10 +7026,8 @@ gui_mch_menu_grey(
}
else
#endif
if (grey)
EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_GRAYED);
else
EnableMenuItem(s_menuBar, menu->id, MF_BYCOMMAND | MF_ENABLED);
(void)EnableMenuItem(menu->parent ? menu->parent->submenu_id : s_menuBar,
menu->id, MF_BYCOMMAND | (grey ? MF_GRAYED : MF_ENABLED));
#ifdef FEAT_TEAROFF
if ((menu->parent != NULL) && (IsWindow(menu->parent->tearoff_handle)))

View File

@@ -2725,7 +2725,8 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv)
* Adjust marks. Invalidate any which lie in the
* changed range, and move any in the remainder of the buffer.
*/
mark_adjust((linenr_T)lo, (linenr_T)(hi - 1), (long)MAXLNUM, (long)extra);
mark_adjust((linenr_T)lo, (linenr_T)(hi - 1),
(long)MAXLNUM, (long)extra);
changed_lines((linenr_T)lo, 0, (linenr_T)hi, (long)extra);
if (buf->buf == curwin->w_buffer)

View File

@@ -347,7 +347,6 @@ Source =
$PYTHON_SRC
$TCL_SRC
$RUBY_SRC
$SNIFF_SRC
$WORKSHOP_SRC
Objects =

View File

@@ -1425,8 +1425,11 @@ open_line(
== FAIL)
goto theend;
/* Postpone calling changed_lines(), because it would mess up folding
* with markers. */
mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L);
* with markers.
* Skip mark_adjust when adding a line after the last one, there can't
* be marks there. */
if (curwin->w_cursor.lnum + 1 < curbuf->b_ml.ml_line_count)
mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L);
did_append = TRUE;
}
#ifdef FEAT_VREPLACE
@@ -2861,7 +2864,10 @@ appended_lines(linenr_T lnum, long count)
void
appended_lines_mark(linenr_T lnum, long count)
{
mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L);
/* Skip mark_adjust when adding a line after the last one, there can't
* be marks there. */
if (lnum + count < curbuf->b_ml.ml_line_count)
mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L);
changed_lines(lnum + 1, 0, lnum + 1, count);
}

View File

@@ -382,18 +382,19 @@ handle_key_queue(void)
void
netbeans_parse_messages(void)
{
readq_T *node;
char_u *buffer;
char_u *p;
int own_node;
while (nb_channel != NULL)
{
buffer = channel_peek(nb_channel, PART_SOCK);
if (buffer == NULL)
node = channel_peek(nb_channel, PART_SOCK);
if (node == NULL)
break; /* nothing to read */
/* Locate the first line in the first buffer. */
p = vim_strchr(buffer, '\n');
/* Locate the end of the first line in the first buffer. */
p = channel_first_nl(node);
if (p == NULL)
{
/* Command isn't complete. If there is no following buffer,
@@ -401,32 +402,35 @@ netbeans_parse_messages(void)
* prepend the text to that buffer and delete this one. */
if (channel_collapse(nb_channel, PART_SOCK, TRUE) == FAIL)
return;
continue;
}
/* There is a complete command at the start of the buffer.
* Terminate it with a NUL. When no more text is following unlink
* the buffer. Do this before executing, because new buffers can
* be added while busy handling the command. */
*p++ = NUL;
if (*p == NUL)
{
own_node = TRUE;
buffer = channel_get(nb_channel, PART_SOCK);
/* "node" is now invalid! */
}
else
{
/* There is a complete command at the start of the buffer.
* Terminate it with a NUL. When no more text is following unlink
* the buffer. Do this before executing, because new buffers can
* be added while busy handling the command. */
*p++ = NUL;
if (*p == NUL)
{
own_node = TRUE;
channel_get(nb_channel, PART_SOCK);
}
else
own_node = FALSE;
/* now, parse and execute the commands */
nb_parse_cmd(buffer);
if (own_node)
/* buffer finished, dispose of it */
vim_free(buffer);
else
/* more follows, move it to the start */
STRMOVE(buffer, p);
own_node = FALSE;
buffer = node->rq_buffer;
}
/* now, parse and execute the commands */
nb_parse_cmd(buffer);
if (own_node)
/* buffer finished, dispose of it */
vim_free(buffer);
else
/* more follows, move it to the start */
channel_consume(nb_channel, PART_SOCK, (int)(p - buffer));
}
}

View File

@@ -3885,7 +3885,11 @@ error:
if (dir == FORWARD)
curbuf->b_op_start.lnum++;
}
mark_adjust(curbuf->b_op_start.lnum + (y_type == MCHAR),
/* Skip mark_adjust when adding lines after the last one, there
* can't be marks there. */
if (curbuf->b_op_start.lnum + (y_type == MCHAR) - 1 + nr_lines
< curbuf->b_ml.ml_line_count)
mark_adjust(curbuf->b_op_start.lnum + (y_type == MCHAR),
(linenr_T)MAXLNUM, nr_lines, 0L);
/* note changed text for displaying and folding */

View File

@@ -1665,7 +1665,7 @@ static struct vimoption options[] =
{"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
(char_u *)&p_kp, PV_KP,
{
#if defined(MSWIN)
#ifdef MSWIN
(char_u *)":help",
#else
# ifdef VMS

View File

@@ -17,14 +17,16 @@ void channel_set_req_callback(channel_T *channel, int part, char_u *callback, pa
void channel_buffer_free(buf_T *buf);
void channel_write_any_lines(void);
void channel_write_new_lines(buf_T *buf);
readq_T *channel_peek(channel_T *channel, int part);
char_u *channel_first_nl(readq_T *node);
char_u *channel_get(channel_T *channel, int part);
void channel_consume(channel_T *channel, int part, int len);
int channel_collapse(channel_T *channel, int part, int want_nl);
int channel_can_write_to(channel_T *channel);
int channel_is_open(channel_T *channel);
char *channel_status(channel_T *channel);
void channel_info(channel_T *channel, dict_T *dict);
void channel_close(channel_T *channel, int invoke_close_cb);
char_u *channel_peek(channel_T *channel, int part);
void channel_clear(channel_T *channel);
void channel_free_all(void);
char_u *channel_read_block(channel_T *channel, int part, int timeout);

View File

@@ -16,6 +16,7 @@ void write_viminfo(char_u *file, int forceit);
int viminfo_readline(vir_T *virp);
char_u *viminfo_readstring(vir_T *virp, int off, int convert);
void viminfo_writestring(FILE *fd, char_u *p);
int barline_writestring(FILE *fd, char_u *s, int remaining_start);
void do_fixdel(exarg_T *eap);
void print_line_no_prefix(linenr_T lnum, int use_number, int list);
void print_line(linenr_T lnum, int use_number, int list);

View File

@@ -37,19 +37,20 @@ void init_history(void);
int get_histtype(char_u *name);
void add_to_history(int histype, char_u *new_entry, int in_map, int sep);
int get_history_idx(int histype);
char_u *get_cmdline_str(void);
int get_cmdline_pos(void);
int set_cmdline_pos(int pos);
int get_cmdline_type(void);
char_u *get_history_entry(int histype, int idx);
int clr_history(int histype);
int del_history_entry(int histype, char_u *str);
int del_history_idx(int histype, int idx);
void remove_key_from_history(void);
char_u *get_cmdline_str(void);
int get_cmdline_pos(void);
int set_cmdline_pos(int pos);
int get_cmdline_type(void);
int get_list_range(char_u **str, int *num1, int *num2);
void ex_history(exarg_T *eap);
void prepare_viminfo_history(int asklen, int writing);
int read_viminfo_history(vir_T *virp, int writing);
void handle_viminfo_history(bval_T *values, int count, int writing);
void finish_viminfo_history(void);
void write_viminfo_history(FILE *fp, int merge);
void cmd_pchar(int c, int offset);

View File

@@ -1014,6 +1014,7 @@ typedef struct
#ifdef FEAT_MBYTE
vimconv_T vir_conv; /* encoding conversion */
#endif
int vir_version; /* viminfo version detected or -1 */
garray_T vir_barlines; /* lines starting with | */
} vir_T;

View File

@@ -179,6 +179,7 @@ NEW_TESTS = test_arglist.res \
test_perl.res \
test_quickfix.res \
test_syntax.res \
test_usercommands.res \
test_viminfo.res \
test_viml.res \
test_visual.res \

View File

@@ -5,7 +5,7 @@ want to separate it from other tests with comment lines.
The numbered tests are older, we have switched to named tests.
And then you can chose between a new style test, which is a Vim script, or an
And then you can choose between a new style test, which is a Vim script, or an
old style test, which uses Normal mode commands. Use a new style test if you
can.
@@ -21,13 +21,14 @@ TO ADD A NEW STYLE TEST:
What you can use (see test_assert.vim for an example):
- Call assert_equal(), assert_true() and assert_false().
- Use try/catch to check for exceptions.
- Use alloc_fail() to have memory allocation fail. This makes it possible to
- Use alloc_fail() to have memory allocation fail. This makes it possible
to check memory allocation failures are handled gracefully. You need to
change the source code to add an ID to the allocation. Update LAST_ID_USED
above alloc_id() to the highest ID used.
- Use disable_char_avail_for_testing(1) if char_avail() must return FALSE for
a while. E.g. to trigger the CursorMovedI autocommand event.
See test_cursor_func.vim for an example
- See the start of runtest.vim for more help.
TO ADD AN OLD STYLE TEST:

View File

@@ -538,6 +538,9 @@ func Test_nl_pipe()
call assert_equal("this", ch_readraw(handle))
call assert_equal("AND this", ch_readraw(handle))
call ch_sendraw(handle, "split this line\n")
call assert_equal("this linethis linethis line", ch_readraw(handle))
let reply = ch_evalraw(handle, "quit\n")
call assert_equal("Goodbye!", reply)
finally

View File

@@ -6,6 +6,7 @@
from __future__ import print_function
import sys
import time
if __name__ == "__main__":
@@ -31,6 +32,15 @@ if __name__ == "__main__":
if typed.startswith("double "):
print(typed[7:-1] + "\nAND " + typed[7:-1])
sys.stdout.flush()
if typed.startswith("split "):
print(typed[6:-1], end='')
sys.stdout.flush()
time.sleep(0.05)
print(typed[6:-1], end='')
sys.stdout.flush()
time.sleep(0.05)
print(typed[6:-1])
sys.stdout.flush()
if typed.startswith("echoerr "):
print(typed[8:-1], file=sys.stderr)
sys.stderr.flush()

View File

@@ -25,6 +25,16 @@ func Test_help_tagjump()
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*arglistid()\*')
helpclose
exec "help! 'autoindent'."
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ "\\*'autoindent'\\*")
helpclose
exec "help! {address}."
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*{address}\*')
helpclose
endfunc
let s:langs = ['en', 'ab', 'ja']

View File

@@ -23,5 +23,4 @@ func Test_reltime()
call assert_true(reltimestr(differs) != '0.0')
call assert_true(reltimefloat(differs) < 0.1)
call assert_true(reltimefloat(differs) > 0.0)
endfunc

View File

@@ -6,4 +6,5 @@ func Test_ptag_with_notagstack()
call assert_fails('ptag does_not_exist_tag_name', 'E426')
set tagstack&vim
endfunc
" vim: sw=2 et

View File

@@ -0,0 +1,48 @@
" Tests for user defined commands
" Test for <mods> in user defined commands
function Test_cmdmods()
let g:mods = ''
command! -nargs=* MyCmd let g:mods .= '<mods> '
MyCmd
aboveleft MyCmd
belowright MyCmd
botright MyCmd
browse MyCmd
confirm MyCmd
hide MyCmd
keepalt MyCmd
keepjumps MyCmd
keepmarks MyCmd
keeppatterns MyCmd
lockmarks MyCmd
noswapfile MyCmd
silent MyCmd
tab MyCmd
topleft MyCmd
verbose MyCmd
vertical MyCmd
aboveleft belowright botright browse confirm hide keepalt keepjumps
\ keepmarks keeppatterns lockmarks noswapfile silent tab
\ topleft verbose vertical MyCmd
call assert_equal(' aboveleft belowright botright browse confirm ' .
\ 'hide keepalt keepjumps keepmarks keeppatterns lockmarks ' .
\ 'noswapfile silent tab topleft verbose vertical aboveleft ' .
\ 'belowright botright browse confirm hide keepalt keepjumps ' .
\ 'keepmarks keeppatterns lockmarks noswapfile silent tab topleft ' .
\ 'verbose vertical ', g:mods)
let g:mods = ''
command! -nargs=* MyQCmd let g:mods .= '<q-mods> '
vertical MyQCmd
call assert_equal('"vertical" ', g:mods)
delcommand MyCmd
delcommand MyQCmd
unlet g:mods
endfunction

View File

@@ -1,6 +1,7 @@
" Test for reading and writing .viminfo
function Test_read_and_write()
call histdel(':')
let lines = [
\ '# comment line',
\ '*encoding=utf-8',
@@ -18,14 +19,16 @@ function Test_read_and_write()
for line in lines
if line[0] == '|'
if done == 0
call assert_equal('|copied as-is', line)
call assert_equal('|1,2', line)
elseif done == 1
call assert_equal('|copied as-is', line)
elseif done == 2
call assert_equal('|and one more', line)
endif
let done += 1
endif
endfor
call assert_equal(2, done)
call assert_equal(3, done)
call delete('Xviminfo')
endfunc
@@ -48,3 +51,68 @@ func Test_global_vars()
call delete('Xviminfo')
set viminfo-=!
endfunc
func Test_cmdline_history()
call histdel(':')
call test_settime(11)
call histadd(':', "echo 'one'")
call test_settime(12)
" split into two lines
let long800 = repeat(" 'eight'", 100)
call histadd(':', "echo " . long800)
call test_settime(13)
" split into three lines
let long1400 = repeat(" 'fourteeeeen'", 100)
call histadd(':', "echo " . long1400)
wviminfo Xviminfo
let lines = readfile('Xviminfo')
let done_colon = 0
let done_bar = 0
let lnum = 0
while lnum < len(lines)
let line = lines[lnum] | let lnum += 1
if line[0] == ':'
if done_colon == 0
call assert_equal(":\x161408", line)
let line = lines[lnum] | let lnum += 1
call assert_equal('<echo ' . long1400, line)
elseif done_colon == 1
call assert_equal(":\x16808", line)
let line = lines[lnum] | let lnum += 1
call assert_equal("<echo " . long800, line)
elseif done_colon == 2
call assert_equal(":echo 'one'", line)
endif
let done_colon += 1
elseif line[0:4] == '|2,0,'
if done_bar == 0
call assert_equal("|2,0,13,,>1407", line)
let line = lines[lnum] | let lnum += 1
call assert_equal('|<"echo ' . long1400[0:484], line)
let line = lines[lnum] | let lnum += 1
call assert_equal('|<' . long1400[485:974], line)
let line = lines[lnum] | let lnum += 1
call assert_equal('|<' . long1400[975:] . '"', line)
elseif done_bar == 1
call assert_equal('|2,0,12,,>807', line)
let line = lines[lnum] | let lnum += 1
call assert_equal('|<"echo ' . long800[0:484], line)
let line = lines[lnum] | let lnum += 1
call assert_equal('|<' . long800[485:] . '"', line)
elseif done_bar == 2
call assert_equal("|2,0,11,,\"echo 'one'\"", line)
endif
let done_bar += 1
endif
endwhile
call assert_equal(3, done_colon)
call assert_equal(3, done_bar)
call histdel(':')
rviminfo Xviminfo
call assert_equal("echo " . long1400, histget(':', -1))
call assert_equal("echo " . long800, histget(':', -2))
call assert_equal("echo 'one'", histget(':', -3))
call delete('Xviminfo')
endfunc

View File

@@ -3,17 +3,22 @@
func Test_win_getid()
edit one
let id1 = win_getid()
let w:one = 'one'
split two
let id2 = win_getid()
let bufnr2 = bufnr('%')
let w:two = 'two'
split three
let id3 = win_getid()
let w:three = 'three'
tabnew
edit four
let id4 = win_getid()
let w:four = 'four'
split five
let id5 = win_getid()
let bufnr5 = bufnr('%')
let w:five = 'five'
tabnext
wincmd w
@@ -28,6 +33,9 @@ func Test_win_getid()
call assert_equal("three", expand("%"))
call assert_equal(id3, win_getid())
let nr3 = winnr()
call assert_equal('one', getwinvar(id1, 'one'))
call assert_equal('two', getwinvar(id2, 'two'))
call assert_equal('three', getwinvar(id3, 'three'))
tabnext
call assert_equal("five", expand("%"))
call assert_equal(id5, win_getid())
@@ -36,7 +44,14 @@ func Test_win_getid()
call assert_equal("four", expand("%"))
call assert_equal(id4, win_getid())
let nr4 = winnr()
call assert_equal('four', getwinvar(id4, 'four'))
call assert_equal('five', getwinvar(id5, 'five'))
call settabwinvar(1, id2, 'two', '2')
call setwinvar(id4, 'four', '4')
tabnext
call assert_equal('4', gettabwinvar(2, id4, 'four'))
call assert_equal('five', gettabwinvar(2, id5, 'five'))
call assert_equal('2', getwinvar(id2, 'two'))
exe nr1 . "wincmd w"
call assert_equal(id1, win_getid())

View File

@@ -753,6 +753,36 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1908,
/**/
1907,
/**/
1906,
/**/
1905,
/**/
1904,
/**/
1903,
/**/
1902,
/**/
1901,
/**/
1900,
/**/
1899,
/**/
1898,
/**/
1897,
/**/
1896,
/**/
1895,
/**/
1894,
/**/
1893,
/**/

View File

@@ -1063,7 +1063,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define OPENLINE_COM_LIST 16 /* format comments with list/2nd line indent */
/*
* There are four history tables:
* There are five history tables:
*/
#define HIST_CMD 0 /* colon commands */
#define HIST_SEARCH 1 /* search commands */
@@ -1072,6 +1072,26 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define HIST_DEBUG 4 /* debug commands */
#define HIST_COUNT 5 /* number of history tables */
/* The type numbers are fixed for backwards compatibility. */
#define BARTYPE_VERSION 1
#define BARTYPE_HISTORY 2
typedef enum {
BVAL_NR,
BVAL_STRING,
BVAL_EMPTY
} btype_T;
#define BVAL_MAX 4 /* Maximum number of fields in a barline. */
typedef struct {
btype_T bv_type;
long bv_nr;
char_u *bv_string;
int bv_len; /* length of bv_string */
int bv_allocated; /* bv_string was allocated */
} bval_T;
/*
* Values for do_tag().
*/
@@ -1887,26 +1907,27 @@ typedef int sock_T;
#define VV_SWAPCOMMAND 48
#define VV_CHAR 49
#define VV_MOUSE_WIN 50
#define VV_MOUSE_LNUM 51
#define VV_MOUSE_COL 52
#define VV_OP 53
#define VV_SEARCHFORWARD 54
#define VV_HLSEARCH 55
#define VV_OLDFILES 56
#define VV_WINDOWID 57
#define VV_PROGPATH 58
#define VV_COMPLETED_ITEM 59
#define VV_OPTION_NEW 60
#define VV_OPTION_OLD 61
#define VV_OPTION_TYPE 62
#define VV_ERRORS 63
#define VV_FALSE 64
#define VV_TRUE 65
#define VV_NULL 66
#define VV_NONE 67
#define VV_VIM_DID_ENTER 68
#define VV_TESTING 69
#define VV_LEN 70 /* number of v: vars */
#define VV_MOUSE_WINID 51
#define VV_MOUSE_LNUM 52
#define VV_MOUSE_COL 53
#define VV_OP 54
#define VV_SEARCHFORWARD 55
#define VV_HLSEARCH 56
#define VV_OLDFILES 57
#define VV_WINDOWID 58
#define VV_PROGPATH 59
#define VV_COMPLETED_ITEM 60
#define VV_OPTION_NEW 61
#define VV_OPTION_OLD 62
#define VV_OPTION_TYPE 63
#define VV_ERRORS 64
#define VV_FALSE 65
#define VV_TRUE 66
#define VV_NULL 67
#define VV_NONE 68
#define VV_VIM_DID_ENTER 69
#define VV_TESTING 70
#define VV_LEN 71 /* number of v: vars */
/* used for v_number in VAR_SPECIAL */
#define VVAL_FALSE 0L
@@ -2333,4 +2354,7 @@ int vim_main2(int argc, char **argv);
#define DIP_OPT 0x10 /* also use "opt" directory in 'packpath' */
#define DIP_NORTP 0x20 /* do not use 'runtimepath' */
/* Lowest number used for window ID. Cannot have this many windows. */
#define LOWEST_WIN_ID 1000
#endif /* VIM__H */

View File

@@ -4422,7 +4422,7 @@ buf_jump_open_tab(buf_T *buf)
}
#endif
static int last_win_id = 0;
static int last_win_id = LOWEST_WIN_ID - 1;
/*
* Allocate a window structure and link it in the window list when "hidden" is