mirror of
https://github.com/zoriya/vim.git
synced 2026-01-06 22:38:16 +00:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d812df6300 | ||
|
|
c590f62349 | ||
|
|
73a9d7b990 | ||
|
|
8dd9ac5a96 | ||
|
|
2161bd8dc1 | ||
|
|
9fd01c6ab8 | ||
|
|
d9205ca1fd | ||
|
|
991e10f3c7 | ||
|
|
85595c5815 | ||
|
|
34b6cb1209 | ||
|
|
f6dad43c98 | ||
|
|
806875ddb5 | ||
|
|
ca9f958114 | ||
|
|
da2bd6ff50 | ||
|
|
24d92ceaf3 | ||
|
|
d6e7cc67c5 | ||
|
|
f2e53dada8 | ||
|
|
6cad8bd4b0 | ||
|
|
89417b99aa | ||
|
|
e511f29adb | ||
|
|
a85fb757a1 | ||
|
|
3094a9e1a7 | ||
|
|
ccf22171f1 | ||
|
|
5bd266c96d | ||
|
|
ac98e5db6e | ||
|
|
12b87e55ba |
1
Filelist
1
Filelist
@@ -285,6 +285,7 @@ SRC_DOS = \
|
||||
src/proto/os_win32.pro \
|
||||
src/proto/os_mswin.pro \
|
||||
src/testdir/Make_dos.mak \
|
||||
src/testdir/Make_ming.mak \
|
||||
src/testdir/dos.vim \
|
||||
src/uninstal.c \
|
||||
src/vim.def \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*cmdline.txt* For Vim version 7.2. Last change: 2008 Jul 29
|
||||
*cmdline.txt* For Vim version 7.2. Last change: 2008 Sep 18
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -157,6 +157,11 @@ CTRL-R {0-9a-z"%#:-=.} *c_CTRL-R* *c_<C-R>*
|
||||
(doesn't work at the expression prompt; some
|
||||
things such as changing the buffer or current
|
||||
window are not allowed to avoid side effects)
|
||||
When the result is a |List| the items are used
|
||||
as lines. They can have line breaks inside
|
||||
too.
|
||||
When the result is a Float it's automatically
|
||||
converted to a String.
|
||||
See |registers| about registers. {not in Vi}
|
||||
Implementation detail: When using the |expression| register
|
||||
and invoking setcmdpos(), this sets the position before
|
||||
@@ -730,19 +735,29 @@ to use |fnameescape()|.
|
||||
In Ex commands, at places where a file name can be used, the following
|
||||
characters have a special meaning. These can also be used in the expression
|
||||
function expand() |expand()|.
|
||||
% is replaced with the current file name *:_%*
|
||||
# is replaced with the alternate file name *:_#*
|
||||
% Is replaced with the current file name. *:_%* *c_%*
|
||||
# Is replaced with the alternate file name. *:_#* *c_#*
|
||||
#n (where n is a number) is replaced with the file name of
|
||||
buffer n. "#0" is the same as "#"
|
||||
## is replaced with all names in the argument list *:_##*
|
||||
buffer n. "#0" is the same as "#".
|
||||
## Is replaced with all names in the argument list *:_##* *c_##*
|
||||
concatenated, separated by spaces. Each space in a name
|
||||
is preceded with a backslash.
|
||||
Note that these give the file name as it was typed. If an absolute path is
|
||||
needed (when using the file name from a different directory), you need to add
|
||||
":p". See |filename-modifiers|.
|
||||
#<n (where n is a number > 0) is replaced with old *:_#<* *c_#<*
|
||||
file name n. See |:oldfiles| or |v:oldfiles| to get the
|
||||
number. *E809*
|
||||
{only when compiled with the +eval and +viminfo features}
|
||||
|
||||
Note that these, except "#<n", give the file name as it was typed. If an
|
||||
absolute path is needed (when using the file name from a different directory),
|
||||
you need to add ":p". See |filename-modifiers|.
|
||||
|
||||
The "#<n" item returns an absolute path, but it will start with "~/" for files
|
||||
below your home directory.
|
||||
|
||||
Note that backslashes are inserted before spaces, so that the command will
|
||||
correctly interpret the file name. But this doesn't happen for shell
|
||||
commands. For those you probably have to use quotes: >
|
||||
commands. For those you probably have to use quotes (this fails for files
|
||||
that contain a quote and wildcards): >
|
||||
:!ls "%"
|
||||
:r !spell "%"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.2. Last change: 2008 Aug 09
|
||||
*eval.txt* For Vim version 7.2. Last change: 2008 Nov 02
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1484,6 +1484,17 @@ v:mouse_col Column number for a mouse click obtained with |getchar()|.
|
||||
This is the screen column number, like with |virtcol()|. The
|
||||
value is zero when there was no mouse button click.
|
||||
|
||||
*v:oldfiles* *oldfiles-variable*
|
||||
v:oldfiles List of file names that is loaded from the |viminfo| file on
|
||||
startup. These are the files that Vim remembers marks for.
|
||||
The length of the List is limited by the ' argument of the
|
||||
'viminfo' option (default is 100).
|
||||
Also see |:oldfiles| and |c_#<|.
|
||||
The List can be modified, but this has no effect on what is
|
||||
stored in the |viminfo| file later. If you use values other
|
||||
than String this will cause trouble.
|
||||
{only when compiled with the +viminfo feature}
|
||||
|
||||
*v:operator* *operator-variable*
|
||||
v:operator The last operator given in Normal mode. This is a single
|
||||
character except for commands starting with <g> or <z>,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*os_vms.txt* For Vim version 7.2. Last change: 2006 Nov 18
|
||||
*os_vms.txt* For Vim version 7.2. Last change: 2008 Aug 19
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL
|
||||
@@ -312,7 +312,7 @@ features, it is worth to choose non GUI executables.
|
||||
|
||||
8. Useful notes *vms-notes*
|
||||
|
||||
8.1 backspace/delete
|
||||
8.1 Backspace/delete
|
||||
8.2 Filters
|
||||
8.3 VMS file version numbers
|
||||
8.4 Directory conversion
|
||||
@@ -326,8 +326,10 @@ features, it is worth to choose non GUI executables.
|
||||
8.12 diff-mode
|
||||
8.13 Allow '$' in C keywords
|
||||
8.14 VIMTUTOR for beginners
|
||||
8.15 Slow start in console mode issue
|
||||
8.16 Common VIM directory - different architectures
|
||||
|
||||
8.1 backspace/delete
|
||||
8.1 Backspace/delete
|
||||
|
||||
There are backspace/delete key inconsistencies with VMS.
|
||||
:fixdel doesn't do the trick, but the solution is: >
|
||||
@@ -663,12 +665,130 @@ start it with: >
|
||||
|
||||
(Thomas.R.Wyant III, Vim 6.1)
|
||||
|
||||
8.14 Slow start in console mode issue
|
||||
|
||||
As GUI/GTK Vim works equally well in console mode, many administartors
|
||||
deploy those executables system wide.
|
||||
Unfortunately, on a remote slow connections GUI/GTK executables behave rather
|
||||
slow when user wants to run Vim just in the console mode - because of X environment detection timeout.
|
||||
|
||||
Luckily, there is a simple solution for that. Administrators need to deploy
|
||||
both GUI/GTK build and just console build executables, like below: >
|
||||
|
||||
|- vim72
|
||||
|----- doc
|
||||
|----- syntax
|
||||
vimrc (system rc files)
|
||||
gvimrc
|
||||
gvim.exe (the remaned GUI or GTK built vim.exe)
|
||||
vim.exe (the console only executable)
|
||||
|
||||
Define system symbols like below in for ex in LOGIN.COM or SYLOGIN.COM: >
|
||||
|
||||
$ define/nolog VIM RF10:[UTIL.VIM72] ! where you VIM directory is
|
||||
$ vi*m :== mcr VIM:VIM.EXE
|
||||
$ gvi*m :== mcr VIM:GVIM.EXE
|
||||
$ ! or you can try to spawn with
|
||||
$ gv*im :== spawn/nowait/input=NLA0 mcr VIM:GVIM.EXE -g -GEOMETRY 80x40
|
||||
|
||||
|
||||
Like this, users that do not have X environment and want to use Vim just in
|
||||
console mode can avoid performance problems.
|
||||
|
||||
(Zoltan Arpadffy, Vim 7.2)
|
||||
|
||||
8.15 Common VIM directory - different architectures
|
||||
|
||||
In a cluster that contains nodes with different architectures like below:
|
||||
|
||||
$show cluster
|
||||
View of Cluster from system ID 11655 node: TOR 18-AUG-2008 11:58:31
|
||||
+---------------------------------+
|
||||
<EFBFBD> SYSTEMS <20> MEMBERS <20>
|
||||
+-----------------------+---------<2D>
|
||||
<EFBFBD> NODE <20> SOFTWARE <20> STATUS <20>
|
||||
+--------+--------------+---------<2D>
|
||||
<EFBFBD> TOR <20> VMS V7.3-2 <20> MEMBER <20>
|
||||
<EFBFBD> TITAN2 <20> VMS V8.3 <20> MEMBER <20>
|
||||
<EFBFBD> ODIN <20> VMS V7.3-2 <20> MEMBER <20>
|
||||
+---------------------------------+
|
||||
|
||||
It is convinient to have a common VIM directory but execute different
|
||||
executables.
|
||||
There are more solutions for this problem:
|
||||
|
||||
solution 1. all executables in the same directory with different names
|
||||
This is easily done with the following script that can be added
|
||||
to the login.com or sylogin.com: >
|
||||
|
||||
$ if f$getsyi("NODE_HWTYPE") .eqs. "VAX"
|
||||
$ then
|
||||
$ say "VAX platform"
|
||||
$ vi*m:== mcr vim:VIM.EXE_VAX
|
||||
$ endif
|
||||
$ if f$getsyi("NODE_HWTYPE") .eqs. "ALPH"
|
||||
$ then
|
||||
$ say "ALPHA platform"
|
||||
$ vi*m :== mcr vim:VIM.EXE_AXP
|
||||
$ endif
|
||||
$ if f$getsyi("ARCH_NAME") .eqs. "IA64"
|
||||
$ then
|
||||
$ say "IA64 platform"
|
||||
$ vi*m :== mcr vim:VIM.EXE_IA64
|
||||
$ endif
|
||||
|
||||
solution 2. different directories: >
|
||||
|
||||
$ if f$getsyi("NODE_HWTYPE") .eqs. "VAX"
|
||||
$ then
|
||||
$ say "VAX platform"
|
||||
$ define/nolog VIM RF10:[UTIL.VAX_EXE] ! VAX executables
|
||||
$ endif
|
||||
$ if f$getsyi("NODE_HWTYPE") .eqs. "ALPH"
|
||||
$ then
|
||||
$ say "ALPHA platform"
|
||||
$ define/nolog VIM RF10:[UTIL.AXP_EXE] ! AXP executables
|
||||
$ endif
|
||||
$ if f$getsyi("ARCH_NAME") .eqs. "IA64"
|
||||
$ then
|
||||
$ say "IA64 platform"
|
||||
$ define/nolog VIM RF10:[UTIL.IA64_EXE] ! IA64 executables
|
||||
$ endif
|
||||
$! VIMRUNTIME must be defined in order to find runtime files
|
||||
$ define/nolog VIMRUNTIME RF10:[UTIL.VIM72]
|
||||
|
||||
A good examle for this approach is the [GNU]gnu_tools.com script from GNU_TOOLS.ZIP
|
||||
package downloadable from http://www.polarhome.com/vim/
|
||||
|
||||
(Zoltan Arpadffy, Vim 7.2)
|
||||
|
||||
==============================================================================
|
||||
|
||||
9. VMS related changes *vms-changes*
|
||||
|
||||
Version 7
|
||||
Recent changes
|
||||
- The following plugins are included into VMS runtime:
|
||||
genutils 2.4, multiselect 2.2, multvals 3.1, selectbuf 4.3,
|
||||
bufexplorer 7.1.7, taglist 4.5
|
||||
- minor changes in vimrc (just in VMS runtime)
|
||||
- make_vms.mms - HUGE model is the default
|
||||
- [TESTDIR]make_vms.mms include as many tests possible
|
||||
- modify test30 and test54 for VMS
|
||||
- enable FLOAT feature in VMS port
|
||||
- os_vms.txt updated
|
||||
|
||||
Version 7.2 (2008 Aug 9)
|
||||
- VCF files write corrected
|
||||
- CTAGS 5.7 included
|
||||
- corrected make_vms.mms (on VAX gave syntax error)
|
||||
|
||||
Version 7.1 (2007 Jun 15)
|
||||
- create TAGS file from menu
|
||||
|
||||
Version 7 (2006 May 8)
|
||||
- Improved low level char input (affects just console mode)
|
||||
- Fixed plugin bug
|
||||
- CTAGS 5.6 included
|
||||
|
||||
Version 6.4 (2005 Oct 15)
|
||||
- GTKLIB and Vim build on IA64
|
||||
@@ -806,6 +926,7 @@ Version 4.5 (1996 Dec 16)
|
||||
|
||||
OpenVMS documentation and executables are maintained by:
|
||||
Zoltan Arpadffy <arpadffy@polarhome.com>
|
||||
OpenVMS Vim page: http://www.polarhome.com/vim/
|
||||
|
||||
This document uses parts and remarks from earlier authors and contributors
|
||||
of OS_VMS.TXT:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*starting.txt* For Vim version 7.2. Last change: 2008 Jun 21
|
||||
*starting.txt* For Vim version 7.2. Last change: 2008 Nov 09
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1337,8 +1337,9 @@ enter Vim and directly start working in your desired setup. |session-file|
|
||||
*viminfo-read*
|
||||
When Vim is started and the 'viminfo' option is non-empty, the contents of
|
||||
the viminfo file are read and the info can be used in the appropriate places.
|
||||
The marks are not read in at startup (but file marks are). See
|
||||
|initialization| for how to set the 'viminfo' option upon startup.
|
||||
The |v:oldfiles| variable is filled. The marks are not read in at startup
|
||||
(but file marks are). See |initialization| for how to set the 'viminfo'
|
||||
option upon startup.
|
||||
|
||||
*viminfo-write*
|
||||
When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo
|
||||
@@ -1372,6 +1373,8 @@ cursor position when the file was last exited. No marks are saved for files
|
||||
that start with any string given with the "r" flag in 'viminfo'. This can be
|
||||
used to avoid saving marks for files on removable media (for MS-DOS you would
|
||||
use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:").
|
||||
The |v:oldfiles| variable is filled with the file names that the viminfo file
|
||||
has marks for.
|
||||
|
||||
*viminfo-file-marks*
|
||||
Uppercase marks ('A to 'Z) are stored when writing the viminfo file. The
|
||||
@@ -1463,8 +1466,8 @@ most of the information will be restored).
|
||||
*:rv* *:rviminfo* *E195*
|
||||
:rv[iminfo][!] [file] Read from viminfo file [file] (default: see above).
|
||||
If [!] is given, then any information that is
|
||||
already set (registers, marks, etc.) will be
|
||||
overwritten. {not in Vi}
|
||||
already set (registers, marks, |v:oldfiles|, etc.)
|
||||
will be overwritten {not in Vi}
|
||||
|
||||
*:wv* *:wviminfo* *E137* *E138* *E574*
|
||||
:wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
|
||||
@@ -1479,4 +1482,20 @@ most of the information will be restored).
|
||||
the .viminfo file.
|
||||
{not in Vi}
|
||||
|
||||
*:ol* *:oldfiles*
|
||||
:ol[dfiles] List the files that have marks stored in the viminfo
|
||||
file. This list is read on startup and only changes
|
||||
afterwards with ":rviminfo!". Also see |v:oldfiles|.
|
||||
The number can be used with |c_#<|.
|
||||
{not in Vi, only when compiled with the +eval feature}
|
||||
|
||||
:bro[wse] ol[dfiles][!]
|
||||
List file names as with |:oldfiles|, and then prompt
|
||||
for a number. When the number is valid that file from
|
||||
the list is edited.
|
||||
If you get the |press-enter| prompt you can press "q"
|
||||
and still get the prompt to enter a file number.
|
||||
Use ! to abondon a modified buffer. |abandon|
|
||||
{not when compiled with tiny or small features}
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_21.txt* For Vim version 7.2. Last change: 2007 May 01
|
||||
*usr_21.txt* For Vim version 7.2. Last change: 2008 Nov 09
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -153,7 +153,7 @@ information. This may cause information that previously exiting Vims stored
|
||||
to be lost. Each item can be remembered only once.
|
||||
|
||||
|
||||
GETTING BACK TO WHERE YOU WERE
|
||||
GETTING BACK TO WHERE YOU STOPPED VIM
|
||||
|
||||
You are halfway editing a file and it's time to leave for holidays. You exit
|
||||
Vim and go enjoy yourselves, forgetting all about your work. After a couple
|
||||
@@ -168,6 +168,48 @@ Mark '9 is lost.
|
||||
The |:marks| command is useful to find out where '0 to '9 will take you.
|
||||
|
||||
|
||||
GETTING BACK TO SOME FILE
|
||||
|
||||
If you want to go back to a file that you edited recently, but not when
|
||||
exiting Vim, there is a slightly more complicated way. You can see a list of
|
||||
files by typing the command: >
|
||||
|
||||
:oldfiles
|
||||
< 1: ~/.viminfo ~
|
||||
2: ~/text/resume.txt ~
|
||||
3: /tmp/draft ~
|
||||
|
||||
Now you would like to edit the second file, which is in the list preceded by
|
||||
"2:". You type: >
|
||||
|
||||
:e #<2
|
||||
|
||||
Instead of ":e" you can use any command that has a file name argument, the
|
||||
"#<2" item works in the same place as "%" (current file name) and "#"
|
||||
(alternate file name). So you can also split the window to edit the third
|
||||
file: >
|
||||
|
||||
:split #<3
|
||||
|
||||
That #<123 thing is a bit complicated when you just want to edit a file.
|
||||
Fortunately there is a simpler way: >
|
||||
|
||||
:browse oldfiles
|
||||
< 1: ~/.viminfo ~
|
||||
2: ~/text/resume.txt ~
|
||||
3: /tmp/draft ~
|
||||
-- More --
|
||||
|
||||
You get the same list of files as with |:oldfiles|. If you want to edit
|
||||
"resume.txt" first press "q" to stop the listing. You will get a prompt:
|
||||
|
||||
Type number and <Enter> (empty cancels): ~
|
||||
|
||||
Type "2" and press <Enter> to edit the second file.
|
||||
|
||||
More info at |:oldfiles|, |v:oldfiles| and |c_#<|.
|
||||
|
||||
|
||||
MOVE INFO FROM ONE VIM TO ANOTHER
|
||||
|
||||
You can use the ":wviminfo" and ":rviminfo" commands to save and restore the
|
||||
|
||||
@@ -234,6 +234,10 @@ else
|
||||
elseif s:line1 =~ '\<DTD\s\+XHTML\s'
|
||||
set ft=xhtml
|
||||
|
||||
" HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
|
||||
elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
|
||||
set ft=html
|
||||
|
||||
" PDF
|
||||
elseif s:line1 =~ '^%PDF-'
|
||||
set ft=pdf
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Makefile for Vim on OpenVMS
|
||||
#
|
||||
# Maintainer: Zoltan Arpadffy <arpadffy@polarhome.com>
|
||||
# Last change: 2007 Oct 22
|
||||
# Last change: 2008 Aug 16
|
||||
#
|
||||
# This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64
|
||||
# with MMS and MMK
|
||||
@@ -36,7 +36,7 @@ DECC = YES
|
||||
# BIG - Many features enabled, as rich as possible. (default)
|
||||
# HUGE - All possible featues enabled.
|
||||
# Please select one of these alternatives above.
|
||||
MODEL = BIG
|
||||
MODEL = HUGE
|
||||
|
||||
# GUI or terminal mode executable.
|
||||
# Comment out if you want just the character terminal mode only.
|
||||
|
||||
@@ -1351,11 +1351,12 @@ set_curbuf(buf, action)
|
||||
}
|
||||
}
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* An autocommand may have deleted "buf", already entered it (e.g., when
|
||||
* it did ":bunload") or aborted the script processing! */
|
||||
# ifdef FEAT_EVAL
|
||||
/* An autocommand may have deleted buf or aborted the script processing! */
|
||||
if (buf_valid(buf) && !aborting())
|
||||
if (buf_valid(buf) && buf != curbuf && !aborting())
|
||||
# else
|
||||
if (buf_valid(buf)) /* an autocommand may have deleted buf! */
|
||||
if (buf_valid(buf) && buf != curbuf)
|
||||
# endif
|
||||
#endif
|
||||
enter_buffer(buf);
|
||||
|
||||
141
src/eval.c
141
src/eval.c
@@ -348,6 +348,7 @@ static struct vimvar
|
||||
{VV_NAME("mouse_col", VAR_NUMBER), 0},
|
||||
{VV_NAME("operator", VAR_STRING), VV_RO},
|
||||
{VV_NAME("searchforward", VAR_NUMBER), 0},
|
||||
{VV_NAME("oldfiles", VAR_LIST), 0},
|
||||
};
|
||||
|
||||
/* shorthand */
|
||||
@@ -355,6 +356,7 @@ static struct vimvar
|
||||
#define vv_nr vv_di.di_tv.vval.v_number
|
||||
#define vv_float vv_di.di_tv.vval.v_float
|
||||
#define vv_str vv_di.di_tv.vval.v_string
|
||||
#define vv_list vv_di.di_tv.vval.v_list
|
||||
#define vv_tv vv_di.di_tv
|
||||
|
||||
/*
|
||||
@@ -426,7 +428,6 @@ static long list_find_nr __ARGS((list_T *l, long idx, int *errorp));
|
||||
static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
|
||||
static void list_append __ARGS((list_T *l, listitem_T *item));
|
||||
static int list_append_tv __ARGS((list_T *l, typval_T *tv));
|
||||
static int list_append_string __ARGS((list_T *l, char_u *str, int len));
|
||||
static int list_append_number __ARGS((list_T *l, varnumber_T n));
|
||||
static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
|
||||
static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef));
|
||||
@@ -845,8 +846,13 @@ eval_clear()
|
||||
p = &vimvars[i];
|
||||
if (p->vv_di.di_tv.v_type == VAR_STRING)
|
||||
{
|
||||
vim_free(p->vv_di.di_tv.vval.v_string);
|
||||
p->vv_di.di_tv.vval.v_string = NULL;
|
||||
vim_free(p->vv_string);
|
||||
p->vv_string = NULL;
|
||||
}
|
||||
else if (p->vv_di.di_tv.v_type == VAR_LIST)
|
||||
{
|
||||
list_unref(p->vv_list);
|
||||
p->vv_list = NULL;
|
||||
}
|
||||
}
|
||||
hash_clear(&vimvarht);
|
||||
@@ -1256,23 +1262,26 @@ skip_expr(pp)
|
||||
|
||||
/*
|
||||
* Top level evaluation function, returning a string.
|
||||
* When "convert" is TRUE convert a List into a sequence of lines and convert
|
||||
* a Float to a String.
|
||||
* Return pointer to allocated memory, or NULL for failure.
|
||||
*/
|
||||
char_u *
|
||||
eval_to_string(arg, nextcmd, dolist)
|
||||
eval_to_string(arg, nextcmd, convert)
|
||||
char_u *arg;
|
||||
char_u **nextcmd;
|
||||
int dolist; /* turn List into sequence of lines */
|
||||
int convert;
|
||||
{
|
||||
typval_T tv;
|
||||
char_u *retval;
|
||||
garray_T ga;
|
||||
char_u numbuf[NUMBUFLEN];
|
||||
|
||||
if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
|
||||
retval = NULL;
|
||||
else
|
||||
{
|
||||
if (dolist && tv.v_type == VAR_LIST)
|
||||
if (convert && tv.v_type == VAR_LIST)
|
||||
{
|
||||
ga_init2(&ga, (int)sizeof(char), 80);
|
||||
if (tv.vval.v_list != NULL)
|
||||
@@ -1280,6 +1289,13 @@ eval_to_string(arg, nextcmd, dolist)
|
||||
ga_append(&ga, NUL);
|
||||
retval = (char_u *)ga.ga_data;
|
||||
}
|
||||
#ifdef FEAT_FLOAT
|
||||
else if (convert && tv.v_type == VAR_FLOAT)
|
||||
{
|
||||
vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
|
||||
retval = vim_strsave(numbuf);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
retval = vim_strsave(get_tv_string(&tv));
|
||||
clear_tv(&tv);
|
||||
@@ -3277,7 +3293,7 @@ ex_call(eap)
|
||||
|
||||
if (*startarg != '(')
|
||||
{
|
||||
EMSG2(_("E107: Missing braces: %s"), eap->arg);
|
||||
EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -6046,6 +6062,25 @@ list_find_nr(l, idx, errorp)
|
||||
return get_tv_number_chk(&li->li_tv, errorp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get list item "l[idx - 1]" as a string. Returns NULL for failure.
|
||||
*/
|
||||
char_u *
|
||||
list_find_str(l, idx)
|
||||
list_T *l;
|
||||
long idx;
|
||||
{
|
||||
listitem_T *li;
|
||||
|
||||
li = list_find(l, idx - 1);
|
||||
if (li == NULL)
|
||||
{
|
||||
EMSGN(_(e_listidx), idx);
|
||||
return NULL;
|
||||
}
|
||||
return get_tv_string(&li->li_tv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Locate "item" list "l" and return its index.
|
||||
* Returns -1 when "item" is not in the list.
|
||||
@@ -6137,7 +6172,7 @@ list_append_dict(list, dict)
|
||||
* When "len" >= 0 use "str[len]".
|
||||
* Returns FAIL when out of memory.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
list_append_string(l, str, len)
|
||||
list_T *l;
|
||||
char_u *str;
|
||||
@@ -6497,6 +6532,9 @@ garbage_collect()
|
||||
set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
|
||||
}
|
||||
|
||||
/* v: vars */
|
||||
set_ref_in_ht(&vimvarht, copyID);
|
||||
|
||||
/*
|
||||
* 2. Go through the list of dicts and free items without the copyID.
|
||||
*/
|
||||
@@ -6587,7 +6625,7 @@ set_ref_in_item(tv, copyID)
|
||||
{
|
||||
case VAR_DICT:
|
||||
dd = tv->vval.v_dict;
|
||||
if (dd->dv_copyID != copyID)
|
||||
if (dd != NULL && dd->dv_copyID != copyID)
|
||||
{
|
||||
/* Didn't see this dict yet. */
|
||||
dd->dv_copyID = copyID;
|
||||
@@ -6597,7 +6635,7 @@ set_ref_in_item(tv, copyID)
|
||||
|
||||
case VAR_LIST:
|
||||
ll = tv->vval.v_list;
|
||||
if (ll->lv_copyID != copyID)
|
||||
if (ll != NULL && ll->lv_copyID != copyID)
|
||||
{
|
||||
/* Didn't see this list yet. */
|
||||
ll->lv_copyID = copyID;
|
||||
@@ -16657,7 +16695,7 @@ f_synstack(argvars, rettv)
|
||||
col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
|
||||
|
||||
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
|
||||
&& col >= 0 && col < (long)STRLEN(ml_get(lnum))
|
||||
&& col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum)))
|
||||
&& rettv_list_alloc(rettv) != FAIL)
|
||||
{
|
||||
(void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
|
||||
@@ -18095,6 +18133,17 @@ get_vim_var_str(idx)
|
||||
return get_tv_string(&vimvars[idx].vv_tv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get List v: variable value. Caller must take care of reference count when
|
||||
* needed.
|
||||
*/
|
||||
list_T *
|
||||
get_vim_var_list(idx)
|
||||
int idx;
|
||||
{
|
||||
return vimvars[idx].vv_list;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set v:count, v:count1 and v:prevcount.
|
||||
*/
|
||||
@@ -18130,6 +18179,20 @@ set_vim_var_string(idx, val, len)
|
||||
vimvars[idx].vv_str = vim_strnsave(val, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set List v: variable to "val".
|
||||
*/
|
||||
void
|
||||
set_vim_var_list(idx, val)
|
||||
int idx;
|
||||
list_T *val;
|
||||
{
|
||||
list_unref(vimvars[idx].vv_list);
|
||||
vimvars[idx].vv_list = val;
|
||||
if (val != NULL)
|
||||
++val->lv_refcount;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set v:register if needed.
|
||||
*/
|
||||
@@ -21890,6 +21953,62 @@ last_set_msg(scriptID)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* List v:oldfiles in a nice way.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
ex_oldfiles(eap)
|
||||
exarg_T *eap;
|
||||
{
|
||||
list_T *l = vimvars[VV_OLDFILES].vv_list;
|
||||
listitem_T *li;
|
||||
int nr = 0;
|
||||
|
||||
if (l == NULL)
|
||||
msg((char_u *)_("No old files"));
|
||||
else
|
||||
{
|
||||
msg_start();
|
||||
msg_scroll = TRUE;
|
||||
for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
|
||||
{
|
||||
msg_outnum((long)++nr);
|
||||
MSG_PUTS(": ");
|
||||
msg_outtrans(get_tv_string(&li->li_tv));
|
||||
msg_putchar('\n');
|
||||
out_flush(); /* output one line at a time */
|
||||
ui_breakcheck();
|
||||
}
|
||||
/* Assume "got_int" was set to truncate the listing. */
|
||||
got_int = FALSE;
|
||||
|
||||
#ifdef FEAT_BROWSE_CMD
|
||||
if (cmdmod.browse)
|
||||
{
|
||||
quit_more = FALSE;
|
||||
nr = prompt_for_number(FALSE);
|
||||
msg_starthere();
|
||||
if (nr > 0)
|
||||
{
|
||||
char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
|
||||
(long)nr);
|
||||
|
||||
if (p != NULL)
|
||||
{
|
||||
p = expand_env_save(p);
|
||||
eap->arg = p;
|
||||
eap->cmdidx = CMD_edit;
|
||||
cmdmod.browse = FALSE;
|
||||
do_exedit(eap, NULL);
|
||||
vim_free(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* FEAT_EVAL */
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ static int linelen __ARGS((int *has_tab));
|
||||
static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out));
|
||||
#ifdef FEAT_VIMINFO
|
||||
static char_u *viminfo_filename __ARGS((char_u *));
|
||||
static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read));
|
||||
static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags));
|
||||
static int viminfo_encoding __ARGS((vir_T *virp));
|
||||
static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing));
|
||||
#endif
|
||||
@@ -1676,14 +1676,12 @@ viminfo_error(errnum, message, line)
|
||||
|
||||
/*
|
||||
* read_viminfo() -- Read the viminfo file. Registers etc. which are already
|
||||
* set are not over-written unless force is TRUE. -- webb
|
||||
* set are not over-written unless "flags" includes VIF_FORCEIT. -- webb
|
||||
*/
|
||||
int
|
||||
read_viminfo(file, want_info, want_marks, forceit)
|
||||
char_u *file;
|
||||
int want_info;
|
||||
int want_marks;
|
||||
int forceit;
|
||||
read_viminfo(file, flags)
|
||||
char_u *file; /* file name or NULL to use default name */
|
||||
int flags; /* VIF_WANT_INFO et al. */
|
||||
{
|
||||
FILE *fp;
|
||||
char_u *fname;
|
||||
@@ -1691,7 +1689,7 @@ read_viminfo(file, want_info, want_marks, forceit)
|
||||
if (no_viminfo())
|
||||
return FAIL;
|
||||
|
||||
fname = viminfo_filename(file); /* may set to default if NULL */
|
||||
fname = viminfo_filename(file); /* get file name in allocated buffer */
|
||||
if (fname == NULL)
|
||||
return FAIL;
|
||||
fp = mch_fopen((char *)fname, READBIN);
|
||||
@@ -1701,8 +1699,9 @@ read_viminfo(file, want_info, want_marks, forceit)
|
||||
verbose_enter();
|
||||
smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
|
||||
fname,
|
||||
want_info ? _(" info") : "",
|
||||
want_marks ? _(" marks") : "",
|
||||
(flags & VIF_WANT_INFO) ? _(" info") : "",
|
||||
(flags & VIF_WANT_MARKS) ? _(" marks") : "",
|
||||
(flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "",
|
||||
fp == NULL ? _(" FAILED") : "");
|
||||
verbose_leave();
|
||||
}
|
||||
@@ -1712,10 +1711,9 @@ read_viminfo(file, want_info, want_marks, forceit)
|
||||
return FAIL;
|
||||
|
||||
viminfo_errcnt = 0;
|
||||
do_viminfo(fp, NULL, want_info, want_marks, forceit);
|
||||
do_viminfo(fp, NULL, flags);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1968,7 +1966,7 @@ write_viminfo(file, forceit)
|
||||
}
|
||||
|
||||
viminfo_errcnt = 0;
|
||||
do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);
|
||||
do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS));
|
||||
|
||||
fclose(fp_out); /* errors are ignored !? */
|
||||
if (fp_in != NULL)
|
||||
@@ -2041,12 +2039,10 @@ viminfo_filename(file)
|
||||
* do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
|
||||
*/
|
||||
static void
|
||||
do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
|
||||
do_viminfo(fp_in, fp_out, flags)
|
||||
FILE *fp_in;
|
||||
FILE *fp_out;
|
||||
int want_info;
|
||||
int want_marks;
|
||||
int force_read;
|
||||
int flags;
|
||||
{
|
||||
int count = 0;
|
||||
int eof = FALSE;
|
||||
@@ -2061,8 +2057,9 @@ do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
|
||||
|
||||
if (fp_in != NULL)
|
||||
{
|
||||
if (want_info)
|
||||
eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL);
|
||||
if (flags & VIF_WANT_INFO)
|
||||
eof = read_viminfo_up_to_marks(&vir,
|
||||
flags & VIF_FORCEIT, fp_out != NULL);
|
||||
else
|
||||
/* Skip info, find start of marks */
|
||||
while (!(eof = viminfo_readline(&vir))
|
||||
@@ -2092,8 +2089,9 @@ do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
|
||||
write_viminfo_bufferlist(fp_out);
|
||||
count = write_viminfo_marks(fp_out);
|
||||
}
|
||||
if (fp_in != NULL && want_marks)
|
||||
copy_viminfo_marks(&vir, fp_out, count, eof);
|
||||
if (fp_in != NULL
|
||||
&& (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
|
||||
copy_viminfo_marks(&vir, fp_out, count, eof, flags);
|
||||
|
||||
vim_free(vir.vir_line);
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -5059,6 +5057,7 @@ skip:
|
||||
|
||||
if (did_sub)
|
||||
++sub_nlines;
|
||||
vim_free(new_start); /* for when substitute was cancelled */
|
||||
vim_free(sub_firstline); /* free the copy of the original line */
|
||||
sub_firstline = NULL;
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ EX(CMD_cquit, "cquit", ex_cquit,
|
||||
EX(CMD_crewind, "crewind", ex_cc,
|
||||
RANGE|NOTADR|COUNT|TRLBAR|BANG),
|
||||
EX(CMD_cscope, "cscope", do_cscope,
|
||||
EXTRA|NOTRLCOM|SBOXOK|XFILE),
|
||||
EXTRA|NOTRLCOM|XFILE),
|
||||
EX(CMD_cstag, "cstag", do_cstag,
|
||||
BANG|TRLBAR|WORD1),
|
||||
EX(CMD_cunmap, "cunmap", ex_unmap,
|
||||
@@ -506,7 +506,7 @@ EX(CMD_lchdir, "lchdir", ex_cd,
|
||||
EX(CMD_lclose, "lclose", ex_cclose,
|
||||
RANGE|NOTADR|COUNT|TRLBAR),
|
||||
EX(CMD_lcscope, "lcscope", do_cscope,
|
||||
EXTRA|NOTRLCOM|SBOXOK|XFILE),
|
||||
EXTRA|NOTRLCOM|XFILE),
|
||||
EX(CMD_left, "left", ex_align,
|
||||
TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
|
||||
EX(CMD_leftabove, "leftabove", ex_wrongmodifier,
|
||||
@@ -635,6 +635,8 @@ EX(CMD_nnoremenu, "nnoremenu", ex_menu,
|
||||
RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
||||
EX(CMD_noremap, "noremap", ex_map,
|
||||
BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
||||
EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier,
|
||||
NEEDARG|EXTRA|NOTRLCOM),
|
||||
EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch,
|
||||
TRLBAR|SBOXOK|CMDWIN),
|
||||
EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate,
|
||||
@@ -651,6 +653,8 @@ EX(CMD_nunmenu, "nunmenu", ex_menu,
|
||||
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
||||
EX(CMD_open, "open", ex_open,
|
||||
RANGE|EXTRA),
|
||||
EX(CMD_oldfiles, "oldfiles", ex_oldfiles,
|
||||
BANG|TRLBAR|SBOXOK|CMDWIN),
|
||||
EX(CMD_omap, "omap", ex_map,
|
||||
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
||||
EX(CMD_omapclear, "omapclear", ex_mapclear,
|
||||
@@ -802,7 +806,7 @@ EX(CMD_scriptnames, "scriptnames", ex_scriptnames,
|
||||
EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
|
||||
WORD1|TRLBAR|CMDWIN),
|
||||
EX(CMD_scscope, "scscope", do_scscope,
|
||||
EXTRA|NOTRLCOM|SBOXOK),
|
||||
EXTRA|NOTRLCOM),
|
||||
EX(CMD_set, "set", ex_set,
|
||||
TRLBAR|EXTRA|CMDWIN|SBOXOK),
|
||||
EX(CMD_setfiletype, "setfiletype", ex_setfiletype,
|
||||
|
||||
@@ -3145,8 +3145,8 @@ do_source(fname, check_other, is_vimrc)
|
||||
verbose_leave();
|
||||
}
|
||||
#ifdef STARTUPTIME
|
||||
vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname);
|
||||
time_msg(IObuff, &tv_start);
|
||||
vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
|
||||
time_msg((char *)IObuff, &tv_start);
|
||||
time_pop(&tv_rel);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -364,6 +364,7 @@ static void ex_tag_cmd __ARGS((exarg_T *eap, char_u *name));
|
||||
# define ex_function ex_ni
|
||||
# define ex_delfunction ex_ni
|
||||
# define ex_return ex_ni
|
||||
# define ex_oldfiles ex_ni
|
||||
#endif
|
||||
static char_u *arg_all __ARGS((void));
|
||||
#ifdef FEAT_SESSION
|
||||
@@ -1770,7 +1771,7 @@ do_one_cmd(cmdlinep, sourcing,
|
||||
}
|
||||
if (checkforcmd(&ea.cmd, "browse", 3))
|
||||
{
|
||||
#ifdef FEAT_BROWSE
|
||||
#ifdef FEAT_BROWSE_CMD
|
||||
cmdmod.browse = TRUE;
|
||||
#endif
|
||||
continue;
|
||||
@@ -2978,6 +2979,7 @@ static struct cmdmod
|
||||
{"keepmarks", 3, FALSE},
|
||||
{"leftabove", 5, FALSE},
|
||||
{"lockmarks", 3, FALSE},
|
||||
{"noautocmd", 3, FALSE},
|
||||
{"rightbelow", 6, FALSE},
|
||||
{"sandbox", 3, FALSE},
|
||||
{"silent", 3, FALSE},
|
||||
@@ -3608,6 +3610,7 @@ set_one_cmd_context(xp, buff)
|
||||
return set_context_in_autocmd(xp, arg, FALSE);
|
||||
|
||||
case CMD_doautocmd:
|
||||
case CMD_doautoall:
|
||||
return set_context_in_autocmd(xp, arg, TRUE);
|
||||
#endif
|
||||
case CMD_set:
|
||||
@@ -9506,24 +9509,50 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped)
|
||||
break;
|
||||
}
|
||||
s = src + 1;
|
||||
if (*s == '<') /* "#<99" uses v:oldfiles */
|
||||
++s;
|
||||
i = (int)getdigits(&s);
|
||||
*usedlen = (int)(s - src); /* length of what we expand */
|
||||
|
||||
buf = buflist_findnr(i);
|
||||
if (buf == NULL)
|
||||
if (src[1] == '<')
|
||||
{
|
||||
*errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
|
||||
if (*usedlen < 2)
|
||||
{
|
||||
/* Should we give an error message for #<text? */
|
||||
*usedlen = 1;
|
||||
return NULL;
|
||||
}
|
||||
#ifdef FEAT_EVAL
|
||||
result = list_find_str(get_vim_var_list(VV_OLDFILES),
|
||||
(long)i);
|
||||
if (result == NULL)
|
||||
{
|
||||
*errormsg = (char_u *)"";
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
*errormsg = (char_u *)_("E809: #< is not available without the +eval feature");
|
||||
return NULL;
|
||||
}
|
||||
if (lnump != NULL)
|
||||
*lnump = ECMD_LAST;
|
||||
if (buf->b_fname == NULL)
|
||||
{
|
||||
result = (char_u *)"";
|
||||
valid = 0; /* Must have ":p:h" to be valid */
|
||||
#endif
|
||||
}
|
||||
else
|
||||
result = buf->b_fname;
|
||||
{
|
||||
buf = buflist_findnr(i);
|
||||
if (buf == NULL)
|
||||
{
|
||||
*errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
|
||||
return NULL;
|
||||
}
|
||||
if (lnump != NULL)
|
||||
*lnump = ECMD_LAST;
|
||||
if (buf->b_fname == NULL)
|
||||
{
|
||||
result = (char_u *)"";
|
||||
valid = 0; /* Must have ":p:h" to be valid */
|
||||
}
|
||||
else
|
||||
result = buf->b_fname;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef FEAT_SEARCHPATH
|
||||
@@ -9541,6 +9570,15 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped)
|
||||
#ifdef FEAT_AUTOCMD
|
||||
case SPEC_AFILE: /* file name for autocommand */
|
||||
result = autocmd_fname;
|
||||
if (result != NULL && !autocmd_fname_full)
|
||||
{
|
||||
/* Still need to turn the fname into a full path. It is
|
||||
* postponed to avoid a delay when <afile> is not used. */
|
||||
autocmd_fname_full = TRUE;
|
||||
result = FullName_save(autocmd_fname, FALSE);
|
||||
vim_free(autocmd_fname);
|
||||
autocmd_fname = result;
|
||||
}
|
||||
if (result == NULL)
|
||||
{
|
||||
*errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
|
||||
@@ -10689,7 +10727,8 @@ ex_viminfo(eap)
|
||||
p_viminfo = (char_u *)"'100";
|
||||
if (eap->cmdidx == CMD_rviminfo)
|
||||
{
|
||||
if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL)
|
||||
if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS
|
||||
| (eap->forceit ? VIF_FORCEIT : 0)) == FAIL)
|
||||
EMSG(_("E195: Cannot open viminfo file for reading"));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -31,6 +31,8 @@ struct cmdline_info
|
||||
int cmdattr; /* attributes for prompt */
|
||||
int overstrike; /* Typing mode on the command line. Shared by
|
||||
getcmdline() and put_on_cmdline(). */
|
||||
expand_T *xpc; /* struct being used for expansion, xp_pattern
|
||||
may point into cmdbuff */
|
||||
int xp_context; /* type of expansion */
|
||||
# ifdef FEAT_EVAL
|
||||
char_u *xp_arg; /* user-defined expansion arg */
|
||||
@@ -38,7 +40,11 @@ struct cmdline_info
|
||||
# endif
|
||||
};
|
||||
|
||||
static struct cmdline_info ccline; /* current cmdline_info */
|
||||
/* The current cmdline_info. It is initialized in getcmdline() and after that
|
||||
* used by other functions. When invoking getcmdline() recursively it needs
|
||||
* to be saved with save_cmdline() and restored with restore_cmdline().
|
||||
* TODO: make it local to getcmdline() and pass it around. */
|
||||
static struct cmdline_info ccline;
|
||||
|
||||
static int cmd_showtail; /* Only show path tail in lists ? */
|
||||
|
||||
@@ -238,6 +244,7 @@ getcmdline(firstc, count, indent)
|
||||
}
|
||||
|
||||
ExpandInit(&xpc);
|
||||
ccline.xpc = &xpc;
|
||||
|
||||
#ifdef FEAT_RIGHTLEFT
|
||||
if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
|
||||
@@ -408,9 +415,10 @@ getcmdline(firstc, count, indent)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>).
|
||||
* When there are matching completions to select <S-Tab> works like
|
||||
* CTRL-P (unless 'wc' is <S-Tab>).
|
||||
*/
|
||||
if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)
|
||||
if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
|
||||
c = Ctrl_P;
|
||||
|
||||
#ifdef FEAT_WILDMENU
|
||||
@@ -1513,6 +1521,7 @@ getcmdline(firstc, count, indent)
|
||||
int old_firstc;
|
||||
|
||||
vim_free(ccline.cmdbuff);
|
||||
xpc.xp_context = EXPAND_NOTHING;
|
||||
if (hiscnt == hislen)
|
||||
p = lookfor; /* back to the old one */
|
||||
else
|
||||
@@ -1839,6 +1848,7 @@ returncmd:
|
||||
#endif
|
||||
|
||||
ExpandCleanup(&xpc);
|
||||
ccline.xpc = NULL;
|
||||
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
if (did_incsearch)
|
||||
@@ -2508,6 +2518,20 @@ realloc_cmdbuff(len)
|
||||
}
|
||||
mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
|
||||
vim_free(p);
|
||||
|
||||
if (ccline.xpc != NULL
|
||||
&& ccline.xpc->xp_pattern != NULL
|
||||
&& ccline.xpc->xp_context != EXPAND_NOTHING
|
||||
&& ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
|
||||
{
|
||||
int i = ccline.xpc->xp_pattern - p;
|
||||
|
||||
/* If xp_pattern points inside the old cmdbuff it needs to be adjusted
|
||||
* to point into the newly allocated memory. */
|
||||
if (i >= 0 && i <= ccline.cmdlen)
|
||||
ccline.xpc->xp_pattern = ccline.cmdbuff + i;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -2875,6 +2899,7 @@ save_cmdline(ccp)
|
||||
prev_ccline = ccline;
|
||||
ccline.cmdbuff = NULL;
|
||||
ccline.cmdprompt = NULL;
|
||||
ccline.xpc = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3582,6 +3607,7 @@ ExpandOne(xp, str, orig, options, mode)
|
||||
ExpandInit(xp)
|
||||
expand_T *xp;
|
||||
{
|
||||
xp->xp_pattern = NULL;
|
||||
xp->xp_backslash = XP_BS_NONE;
|
||||
#ifndef BACKSLASH_IN_FILENAME
|
||||
xp->xp_shell = FALSE;
|
||||
|
||||
@@ -767,9 +767,13 @@
|
||||
|
||||
/*
|
||||
* +browse ":browse" command.
|
||||
* or just the ":browse" command modifier
|
||||
*/
|
||||
#if defined(FEAT_NORMAL) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC))
|
||||
# define FEAT_BROWSE
|
||||
#if defined(FEAT_NORMAL)
|
||||
# define FEAT_BROWSE_CMD
|
||||
# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)
|
||||
# define FEAT_BROWSE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
14
src/fileio.c
14
src/fileio.c
@@ -2711,7 +2711,7 @@ check_marks_read()
|
||||
{
|
||||
if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
|
||||
&& curbuf->b_ffname != NULL)
|
||||
read_viminfo(NULL, FALSE, TRUE, FALSE);
|
||||
read_viminfo(NULL, VIF_WANT_MARKS);
|
||||
|
||||
/* Always set b_marks_read; needed when 'viminfo' is changed to include
|
||||
* the ' parameter after opening a buffer. */
|
||||
@@ -8523,6 +8523,7 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
|
||||
char_u *save_sourcing_name;
|
||||
linenr_T save_sourcing_lnum;
|
||||
char_u *save_autocmd_fname;
|
||||
int save_autocmd_fname_full;
|
||||
int save_autocmd_bufnr;
|
||||
char_u *save_autocmd_match;
|
||||
int save_autocmd_busy;
|
||||
@@ -8601,6 +8602,7 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
|
||||
* Save the autocmd_* variables and info about the current buffer.
|
||||
*/
|
||||
save_autocmd_fname = autocmd_fname;
|
||||
save_autocmd_fname_full = autocmd_fname_full;
|
||||
save_autocmd_bufnr = autocmd_bufnr;
|
||||
save_autocmd_match = autocmd_match;
|
||||
save_autocmd_busy = autocmd_busy;
|
||||
@@ -8618,14 +8620,15 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
|
||||
if (fname != NULL && *fname != NUL)
|
||||
autocmd_fname = fname;
|
||||
else if (buf != NULL)
|
||||
autocmd_fname = buf->b_fname;
|
||||
autocmd_fname = buf->b_ffname;
|
||||
else
|
||||
autocmd_fname = NULL;
|
||||
}
|
||||
else
|
||||
autocmd_fname = fname_io;
|
||||
if (autocmd_fname != NULL)
|
||||
autocmd_fname = FullName_save(autocmd_fname, FALSE);
|
||||
autocmd_fname = vim_strsave(autocmd_fname);
|
||||
autocmd_fname_full = FALSE; /* call FullName_save() later */
|
||||
|
||||
/*
|
||||
* Set the buffer number to be used for <abuf>.
|
||||
@@ -8810,6 +8813,7 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
|
||||
sourcing_lnum = save_sourcing_lnum;
|
||||
vim_free(autocmd_fname);
|
||||
autocmd_fname = save_autocmd_fname;
|
||||
autocmd_fname_full = save_autocmd_fname_full;
|
||||
autocmd_bufnr = save_autocmd_bufnr;
|
||||
autocmd_match = save_autocmd_match;
|
||||
#ifdef FEAT_EVAL
|
||||
@@ -8918,7 +8922,7 @@ auto_next_pat(apc, stop_at_last)
|
||||
{
|
||||
apc->curpat = NULL;
|
||||
|
||||
/* only use a pattern when it has not been removed, has commands and
|
||||
/* Only use a pattern when it has not been removed, has commands and
|
||||
* the group matches. For buffer-local autocommands only check the
|
||||
* buffer number. */
|
||||
if (ap->pat != NULL && ap->cmds != NULL
|
||||
@@ -9104,7 +9108,7 @@ static int include_groups = FALSE;
|
||||
set_context_in_autocmd(xp, arg, doautocmd)
|
||||
expand_T *xp;
|
||||
char_u *arg;
|
||||
int doautocmd; /* TRUE for :doautocmd, FALSE for :autocmd */
|
||||
int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */
|
||||
{
|
||||
char_u *p;
|
||||
int group;
|
||||
|
||||
@@ -1022,6 +1022,7 @@ EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */
|
||||
#endif
|
||||
#ifdef FEAT_AUTOCMD
|
||||
EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
|
||||
EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
|
||||
EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
|
||||
EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
|
||||
EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
|
||||
|
||||
@@ -136,6 +136,9 @@ EXTERN_C void boot_DynaLoader __ARGS((pTHX_ CV*));
|
||||
# define Perl_newXS_flags dll_Perl_newXS_flags
|
||||
#endif
|
||||
# define Perl_sv_free dll_Perl_sv_free
|
||||
# if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
|
||||
# define Perl_sv_free2 dll_Perl_sv_free2
|
||||
# endif
|
||||
# define Perl_sv_isa dll_Perl_sv_isa
|
||||
# define Perl_sv_magic dll_Perl_sv_magic
|
||||
# define Perl_sv_setiv dll_Perl_sv_setiv
|
||||
@@ -268,6 +271,7 @@ static SV* (*Perl_Isv_yes_ptr)(register PerlInterpreter*);
|
||||
static void (*boot_DynaLoader)_((pTHX_ CV*));
|
||||
|
||||
#if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
|
||||
static void (*Perl_sv_free2)(pTHX_ SV*);
|
||||
static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
|
||||
static void (*Perl_sys_term)(void);
|
||||
static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
|
||||
@@ -367,6 +371,7 @@ static struct {
|
||||
{"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr},
|
||||
{"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
|
||||
#else
|
||||
{"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
|
||||
{"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
|
||||
{"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
|
||||
{"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
|
||||
|
||||
@@ -645,11 +645,12 @@ main
|
||||
|
||||
#ifdef FEAT_VIMINFO
|
||||
/*
|
||||
* Read in registers, history etc, but not marks, from the viminfo file
|
||||
* Read in registers, history etc, but not marks, from the viminfo file.
|
||||
* This is where v:oldfiles gets filled.
|
||||
*/
|
||||
if (*p_viminfo != NUL)
|
||||
{
|
||||
read_viminfo(NULL, TRUE, FALSE, FALSE);
|
||||
read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
|
||||
TIME_MSG("reading viminfo");
|
||||
}
|
||||
#endif
|
||||
@@ -1457,7 +1458,8 @@ parse_command_name(parmp)
|
||||
++initstr;
|
||||
}
|
||||
|
||||
if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k')
|
||||
/* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */
|
||||
if (TOLOWER_ASC(initstr[0]) == 'g')
|
||||
{
|
||||
main_start_gui();
|
||||
#ifdef FEAT_GUI
|
||||
|
||||
28
src/mark.c
28
src/mark.c
@@ -1627,15 +1627,17 @@ write_one_mark(fp_out, c, pos)
|
||||
|
||||
/*
|
||||
* Handle marks in the viminfo file:
|
||||
* fp_out == NULL read marks for current buffer only
|
||||
* fp_out != NULL copy marks for buffers not in buffer list
|
||||
* fp_out != NULL: copy marks for buffers not in buffer list
|
||||
* fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
|
||||
* fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
|
||||
*/
|
||||
void
|
||||
copy_viminfo_marks(virp, fp_out, count, eof)
|
||||
copy_viminfo_marks(virp, fp_out, count, eof, flags)
|
||||
vir_T *virp;
|
||||
FILE *fp_out;
|
||||
int count;
|
||||
int eof;
|
||||
int flags;
|
||||
{
|
||||
char_u *line = virp->vir_line;
|
||||
buf_T *buf;
|
||||
@@ -1647,10 +1649,23 @@ copy_viminfo_marks(virp, fp_out, count, eof)
|
||||
char_u *p;
|
||||
char_u *name_buf;
|
||||
pos_T pos;
|
||||
#ifdef FEAT_EVAL
|
||||
list_T *list = NULL;
|
||||
#endif
|
||||
|
||||
if ((name_buf = alloc(LSIZE)) == NULL)
|
||||
return;
|
||||
*name_buf = NUL;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT)))
|
||||
{
|
||||
list = list_alloc();
|
||||
if (list != NULL)
|
||||
set_vim_var_list(VV_OLDFILES, list);
|
||||
}
|
||||
#endif
|
||||
|
||||
num_marked_files = get_viminfo_parameter('\'');
|
||||
while (!eof && (count < num_marked_files || fp_out == NULL))
|
||||
{
|
||||
@@ -1681,6 +1696,11 @@ copy_viminfo_marks(virp, fp_out, count, eof)
|
||||
p++;
|
||||
*p = NUL;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
if (list != NULL)
|
||||
list_append_string(list, str, -1);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If fp_out == NULL, load marks for current buffer.
|
||||
* If fp_out != NULL, copy marks for buffers not in buflist.
|
||||
@@ -1688,7 +1708,7 @@ copy_viminfo_marks(virp, fp_out, count, eof)
|
||||
load_marks = copy_marks_out = FALSE;
|
||||
if (fp_out == NULL)
|
||||
{
|
||||
if (curbuf->b_ffname != NULL)
|
||||
if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL)
|
||||
{
|
||||
if (*name_buf == NUL) /* only need to do this once */
|
||||
home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE);
|
||||
|
||||
@@ -2540,7 +2540,6 @@ utf_head_off(base, p)
|
||||
return (int)(p - q);
|
||||
}
|
||||
|
||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||
/*
|
||||
* Copy a character from "*fp" to "*tp" and advance the pointers.
|
||||
*/
|
||||
@@ -2555,7 +2554,6 @@ mb_copy_char(fp, tp)
|
||||
*tp += l;
|
||||
*fp += l;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return the offset from "p" to the first byte of a character. When "p" is
|
||||
|
||||
@@ -3245,9 +3245,9 @@ prompt_for_number(mouse_used)
|
||||
|
||||
/* When using ":silent" assume that <CR> was entered. */
|
||||
if (mouse_used != NULL)
|
||||
MSG_PUTS(_("Type number or click with mouse (<Enter> cancels): "));
|
||||
MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): "));
|
||||
else
|
||||
MSG_PUTS(_("Choice number (<Enter> cancels): "));
|
||||
MSG_PUTS(_("Type number and <Enter> (empty cancels): "));
|
||||
|
||||
/* Set the state such that text can be selected/copied/pasted and we still
|
||||
* get mouse events. */
|
||||
|
||||
@@ -1257,7 +1257,6 @@ vim_strsave_escaped_ext(string, esc_chars, cc, bsl)
|
||||
return escaped_string;
|
||||
}
|
||||
|
||||
#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
|
||||
/*
|
||||
* Return TRUE when 'shell' has "csh" in the tail.
|
||||
*/
|
||||
@@ -1266,9 +1265,7 @@ csh_like_shell()
|
||||
{
|
||||
return (strstr((char *)gettail(p_sh), "csh") != NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||
/*
|
||||
* Escape "string" for use as a shell argument with system().
|
||||
* This uses single quotes, except when we know we need to use double qoutes
|
||||
@@ -1391,7 +1388,6 @@ vim_strsave_shellescape(string, do_special)
|
||||
|
||||
return escaped_string;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Like vim_strsave(), but make all characters uppercase.
|
||||
|
||||
97
src/normal.c
97
src/normal.c
@@ -183,6 +183,8 @@ static void nv_drop __ARGS((cmdarg_T *cap));
|
||||
static void nv_cursorhold __ARGS((cmdarg_T *cap));
|
||||
#endif
|
||||
|
||||
static char *e_noident = N_("E349: No identifier under cursor");
|
||||
|
||||
/*
|
||||
* Function to be called for a Normal or Visual mode command.
|
||||
* The argument is a cmdarg_T.
|
||||
@@ -1132,7 +1134,8 @@ getcount:
|
||||
out_flush();
|
||||
#endif
|
||||
#ifdef FEAT_AUTOCMD
|
||||
did_cursorhold = FALSE;
|
||||
if (ca.cmdchar != K_IGNORE)
|
||||
did_cursorhold = FALSE;
|
||||
#endif
|
||||
|
||||
State = NORMAL;
|
||||
@@ -3509,7 +3512,7 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type)
|
||||
if (find_type & FIND_STRING)
|
||||
EMSG(_("E348: No string under cursor"));
|
||||
else
|
||||
EMSG(_("E349: No identifier under cursor"));
|
||||
EMSG(_(e_noident));
|
||||
return 0;
|
||||
}
|
||||
ptr += col;
|
||||
@@ -5469,6 +5472,20 @@ nv_ident(cap)
|
||||
STRCPY(buf, "he! ");
|
||||
else
|
||||
{
|
||||
/* An external command will probably use an argument starting
|
||||
* with "-" as an option. To avoid trouble we skip the "-". */
|
||||
while (*ptr == '-' && n > 0)
|
||||
{
|
||||
++ptr;
|
||||
--n;
|
||||
}
|
||||
if (n == 0)
|
||||
{
|
||||
EMSG(_(e_noident)); /* found dashes only */
|
||||
vim_free(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
/* When a count is given, turn it into a range. Is this
|
||||
* really what we want? */
|
||||
isman = (STRCMP(kp, "man") == 0);
|
||||
@@ -5511,37 +5528,59 @@ nv_ident(cap)
|
||||
/*
|
||||
* Now grab the chars in the identifier
|
||||
*/
|
||||
if (cmdchar == '*')
|
||||
aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
|
||||
else if (cmdchar == '#')
|
||||
aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
|
||||
else if (cmdchar == 'K' && !kp_help)
|
||||
aux_ptr = (char_u *)" \t\\\"|!";
|
||||
else
|
||||
/* Don't escape spaces and Tabs in a tag with a backslash */
|
||||
aux_ptr = (char_u *)"\\|\"";
|
||||
|
||||
p = buf + STRLEN(buf);
|
||||
while (n-- > 0)
|
||||
if (cmdchar == 'K' && !kp_help)
|
||||
{
|
||||
/* put a backslash before \ and some others */
|
||||
if (vim_strchr(aux_ptr, *ptr) != NULL)
|
||||
*p++ = '\\';
|
||||
#ifdef FEAT_MBYTE
|
||||
/* When current byte is a part of multibyte character, copy all bytes
|
||||
* of that character. */
|
||||
if (has_mbyte)
|
||||
/* Escape the argument properly for a shell command */
|
||||
ptr = vim_strnsave(ptr, n);
|
||||
p = vim_strsave_shellescape(ptr, TRUE);
|
||||
vim_free(ptr);
|
||||
if (p == NULL)
|
||||
{
|
||||
int i;
|
||||
int len = (*mb_ptr2len)(ptr) - 1;
|
||||
|
||||
for (i = 0; i < len && n >= 1; ++i, --n)
|
||||
*p++ = *ptr++;
|
||||
vim_free(buf);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
*p++ = *ptr++;
|
||||
buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
|
||||
if (buf == NULL)
|
||||
{
|
||||
vim_free(buf);
|
||||
vim_free(p);
|
||||
return;
|
||||
}
|
||||
STRCAT(buf, p);
|
||||
vim_free(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cmdchar == '*')
|
||||
aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
|
||||
else if (cmdchar == '#')
|
||||
aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
|
||||
else
|
||||
/* Don't escape spaces and Tabs in a tag with a backslash */
|
||||
aux_ptr = (char_u *)"\\|\"\n*?[";
|
||||
|
||||
p = buf + STRLEN(buf);
|
||||
while (n-- > 0)
|
||||
{
|
||||
/* put a backslash before \ and some others */
|
||||
if (vim_strchr(aux_ptr, *ptr) != NULL)
|
||||
*p++ = '\\';
|
||||
#ifdef FEAT_MBYTE
|
||||
/* When current byte is a part of multibyte character, copy all
|
||||
* bytes of that character. */
|
||||
if (has_mbyte)
|
||||
{
|
||||
int i;
|
||||
int len = (*mb_ptr2len)(ptr) - 1;
|
||||
|
||||
for (i = 0; i < len && n >= 1; ++i, --n)
|
||||
*p++ = *ptr++;
|
||||
}
|
||||
#endif
|
||||
*p++ = *ptr++;
|
||||
}
|
||||
*p = NUL;
|
||||
}
|
||||
*p = NUL;
|
||||
|
||||
/*
|
||||
* Execute the command.
|
||||
|
||||
11
src/option.c
11
src/option.c
@@ -2593,13 +2593,13 @@ static struct vimoption
|
||||
#ifdef FEAT_VIMINFO
|
||||
(char_u *)&p_viminfo, PV_NONE,
|
||||
#if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
||||
{(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
|
||||
{(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
|
||||
#else
|
||||
# ifdef AMIGA
|
||||
{(char_u *)"",
|
||||
(char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
|
||||
(char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
|
||||
# else
|
||||
{(char_u *)"", (char_u *)"'20,<50,s10,h"}
|
||||
{(char_u *)"", (char_u *)"'100,<50,s10,h"}
|
||||
# endif
|
||||
#endif
|
||||
#else
|
||||
@@ -7974,6 +7974,11 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
|
||||
else /* curwin->w_p_scr > curwin->w_height */
|
||||
curwin->w_p_scr = curwin->w_height;
|
||||
}
|
||||
if (p_hi < 0)
|
||||
{
|
||||
errmsg = e_positive;
|
||||
p_hi = 0;
|
||||
}
|
||||
if (p_report < 0)
|
||||
{
|
||||
errmsg = e_positive;
|
||||
|
||||
@@ -114,6 +114,8 @@
|
||||
#define HAVE_PUTENV
|
||||
#define HAVE_SETENV
|
||||
#define HAVE_SETJMP_H
|
||||
#define HAVE_MATH_H
|
||||
#define HAVE_FLOAT_FUNCS
|
||||
|
||||
#undef HAVE_DIRENT_H
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
@@ -17,7 +17,7 @@ void eval_patch __ARGS((char_u *origfile, char_u *difffile, char_u *outfile));
|
||||
int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip));
|
||||
char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip));
|
||||
int skip_expr __ARGS((char_u **pp));
|
||||
char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));
|
||||
char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert));
|
||||
char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox));
|
||||
int eval_to_number __ARGS((char_u *expr));
|
||||
list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
|
||||
@@ -46,7 +46,9 @@ list_T *list_alloc __ARGS((void));
|
||||
void list_unref __ARGS((list_T *l));
|
||||
void list_free __ARGS((list_T *l, int recurse));
|
||||
dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
|
||||
char_u *list_find_str __ARGS((list_T *l, long idx));
|
||||
int list_append_dict __ARGS((list_T *list, dict_T *dict));
|
||||
int list_append_string __ARGS((list_T *l, char_u *str, int len));
|
||||
int garbage_collect __ARGS((void));
|
||||
dict_T *dict_alloc __ARGS((void));
|
||||
int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
|
||||
@@ -58,8 +60,10 @@ long do_searchpair __ARGS((char_u *spat, char_u *mpat, char_u *epat, int dir, ch
|
||||
void set_vim_var_nr __ARGS((int idx, long val));
|
||||
long get_vim_var_nr __ARGS((int idx));
|
||||
char_u *get_vim_var_str __ARGS((int idx));
|
||||
list_T *get_vim_var_list __ARGS((int idx));
|
||||
void set_vcount __ARGS((long count, long count1));
|
||||
void set_vim_var_string __ARGS((int idx, char_u *val, int len));
|
||||
void set_vim_var_list __ARGS((int idx, list_T *val));
|
||||
void set_reg_var __ARGS((int c));
|
||||
char_u *v_exception __ARGS((char_u *oldval));
|
||||
char_u *v_throwpoint __ARGS((char_u *oldval));
|
||||
@@ -94,6 +98,7 @@ int read_viminfo_varlist __ARGS((vir_T *virp, int writing));
|
||||
void write_viminfo_varlist __ARGS((FILE *fp));
|
||||
int store_session_globals __ARGS((FILE *fd));
|
||||
void last_set_msg __ARGS((scid_T scriptID));
|
||||
void ex_oldfiles __ARGS((exarg_T *eap));
|
||||
int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
|
||||
char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
|
||||
/* vim: set ft=c : */
|
||||
|
||||
@@ -11,7 +11,7 @@ void do_shell __ARGS((char_u *cmd, int flags));
|
||||
char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
|
||||
void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
|
||||
int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
|
||||
int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
|
||||
int read_viminfo __ARGS((char_u *file, int flags));
|
||||
void write_viminfo __ARGS((char_u *file, int forceit));
|
||||
int viminfo_readline __ARGS((vir_T *virp));
|
||||
char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
|
||||
|
||||
@@ -26,5 +26,5 @@ int read_viminfo_filemark __ARGS((vir_T *virp, int force));
|
||||
void write_viminfo_filemarks __ARGS((FILE *fp));
|
||||
int removable __ARGS((char_u *name));
|
||||
int write_viminfo_marks __ARGS((FILE *fp_out));
|
||||
void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof));
|
||||
void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags));
|
||||
/* vim: set ft=c : */
|
||||
|
||||
14
src/screen.c
14
src/screen.c
@@ -2439,9 +2439,17 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
|
||||
|
||||
#ifdef FEAT_SYN_HL
|
||||
/* Show 'cursorcolumn' in the fold line. */
|
||||
if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp))
|
||||
ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr(
|
||||
ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC));
|
||||
if (wp->w_p_cuc)
|
||||
{
|
||||
txtcol += wp->w_virtcol;
|
||||
if (wp->w_p_wrap)
|
||||
txtcol -= wp->w_skipcol;
|
||||
else
|
||||
txtcol -= wp->w_leftcol;
|
||||
if (txtcol >= 0 && txtcol < W_WIDTH(wp))
|
||||
ScreenAttrs[off + txtcol] = hl_combine_attr(
|
||||
ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
|
||||
}
|
||||
#endif
|
||||
|
||||
SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
|
||||
|
||||
@@ -459,7 +459,7 @@ typedef struct expand
|
||||
typedef struct
|
||||
{
|
||||
int hide; /* TRUE when ":hide" was used */
|
||||
# ifdef FEAT_BROWSE
|
||||
# ifdef FEAT_BROWSE_CMD
|
||||
int browse; /* TRUE to invoke file dialog */
|
||||
# endif
|
||||
# ifdef FEAT_WINDOWS
|
||||
|
||||
91
src/testdir/Make_ming.mak
Normal file
91
src/testdir/Make_ming.mak
Normal file
@@ -0,0 +1,91 @@
|
||||
# Makefile to run tests for Vim, on Dos-like machines
|
||||
# with sh.exe or zsh.exe in the path or not.
|
||||
#
|
||||
# Author: Bill McCarthy
|
||||
#
|
||||
# Note that test54 has been removed until it is fixed.
|
||||
#
|
||||
# Requires a set of Unix tools: echo, diff, etc.
|
||||
|
||||
ifneq (sh.exe, $(SHELL))
|
||||
DEL = rm -f
|
||||
MV = mv
|
||||
CP = cp
|
||||
DIRSLASH = /
|
||||
else
|
||||
DEL = del
|
||||
MV = rename
|
||||
CP = copy
|
||||
DIRSLASH = \\
|
||||
endif
|
||||
|
||||
VIMPROG = ..$(DIRSLASH)vim
|
||||
|
||||
# Omitted:
|
||||
# test2 "\\tmp" doesn't work.
|
||||
# test10 'errorformat' is different
|
||||
# test12 can't unlink a swap file
|
||||
# test25 uses symbolic link
|
||||
# test27 can't edit file with "*" in file name
|
||||
# test31 16 bit version runs out of memory...
|
||||
|
||||
SCRIPTS16 = test1.out test19.out test20.out test22.out \
|
||||
test23.out test24.out test28.out test29.out \
|
||||
test35.out test36.out test43.out \
|
||||
test44.out test45.out test46.out test47.out \
|
||||
test48.out test51.out test53.out \
|
||||
test55.out test56.out test57.out test58.out test59.out \
|
||||
test60.out test61.out test62.out test63.out test64.out
|
||||
|
||||
# Had to remove test54 which doesn't work yet.
|
||||
# test54.out
|
||||
|
||||
SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
||||
test8.out test9.out test11.out test13.out test14.out \
|
||||
test15.out test17.out test18.out test21.out test26.out \
|
||||
test30.out test31.out test32.out test33.out test34.out \
|
||||
test37.out test38.out test39.out test40.out test41.out \
|
||||
test42.out test52.out test65.out
|
||||
|
||||
SCRIPTS32 = test50.out
|
||||
|
||||
SCRIPTS_GUI = test16.out
|
||||
|
||||
.SUFFIXES: .in .out
|
||||
|
||||
vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
|
||||
echo ALL DONE
|
||||
|
||||
nongui: fixff $(SCRIPTS16) $(SCRIPTS)
|
||||
echo ALL DONE
|
||||
|
||||
small:
|
||||
echo ALL DONE
|
||||
|
||||
gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
|
||||
echo ALL DONE
|
||||
|
||||
win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
|
||||
echo ALL DONE
|
||||
|
||||
fixff:
|
||||
-$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
|
||||
|
||||
clean:
|
||||
-$(DEL) *.out
|
||||
-$(DEL) test.ok
|
||||
-$(DEL) small.vim
|
||||
-$(DEL) tiny.vim
|
||||
-$(DEL) mbyte.vim
|
||||
-$(DEL) X*
|
||||
-$(DEL) viminfo
|
||||
|
||||
.in.out:
|
||||
$(CP) $*.ok test.ok
|
||||
$(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
|
||||
diff test.out $*.ok
|
||||
-$(DEL) $*.out
|
||||
$(MV) test.out $*.out
|
||||
-$(DEL) X*
|
||||
-$(DEL) test.ok
|
||||
-$(DEL) viminfo
|
||||
@@ -4,9 +4,9 @@
|
||||
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
||||
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
||||
#
|
||||
# Last change: 2008 Jun 19
|
||||
# Last change: 2008 Aug 19
|
||||
#
|
||||
# This has been tested on VMS 6.2 to 7.2 on DEC Alpha and VAX.
|
||||
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
||||
# Edit the lines in the Configuration section below to select.
|
||||
#
|
||||
# Execute with:
|
||||
@@ -32,6 +32,15 @@
|
||||
# and directory handling.
|
||||
# WANT_UNIX = YES
|
||||
|
||||
# Comment out if you want to run Win32 specific tests as well, but please
|
||||
# be aware, that on OpenVMS will fail, because of cat, rm, etc commands
|
||||
# and directory handling.
|
||||
# WANT_WIN = YES
|
||||
|
||||
# Comment out if you want to run spell checker tests.
|
||||
# They fail because VMS does not support file names.
|
||||
# WANT_SPELL = YES
|
||||
|
||||
# Comment out if you have gzip on your system
|
||||
# HAVE_GZIP = YES
|
||||
|
||||
@@ -53,12 +62,12 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
|
||||
test13.out test14.out test15.out test17.out \
|
||||
test18.out test19.out test20.out test21.out test22.out \
|
||||
test23.out test24.out test26.out \
|
||||
test28.out test29.out test31.out test32.out \
|
||||
test28.out test29.out test30.out test31.out test32.out \
|
||||
test33.out test34.out test35.out test36.out test37.out \
|
||||
test38.out test39.out test40.out test41.out test42.out \
|
||||
test43.out test44.out test45.out test46.out \
|
||||
test48.out test51.out test53.out test54.out test55.out \
|
||||
test56.out test57.out test58.out test59.out test60.out \
|
||||
test56.out test57.out test60.out \
|
||||
test61.out test62.out test63.out test64.out test65.out
|
||||
|
||||
.IFDEF WANT_GUI
|
||||
@@ -67,7 +76,15 @@ GUI_OPTION = -g
|
||||
.ENDIF
|
||||
|
||||
.IFDEF WANT_UNIX
|
||||
SCRIPT_UNIX = test10.out test12.out test25.out test27.out test30.out test49.out
|
||||
SCRIPT_UNIX = test10.out test12.out test25.out test27.out test49.out
|
||||
.ENDIF
|
||||
|
||||
.IFDEF WANT_WIN
|
||||
SCRIPT_WIN = test50.out test52.out
|
||||
.ENDIF
|
||||
|
||||
.IFDEF WANT_SPELL
|
||||
SCRIPT_SPELL = test58.out test59.out
|
||||
.ENDIF
|
||||
|
||||
.IFDEF HAVE_GZIP
|
||||
@@ -84,11 +101,11 @@ SCRIPT_GDIFF = test47.out
|
||||
-@ write sys$output " "$*" "
|
||||
-@ write sys$output "-----------------------------------------------"
|
||||
-@ create/term/wait mcr $(VIMPROG) $(GUI_OPTION) -u vms.vim --noplugin -s dotest.in $*.in
|
||||
-@ if "''F$SEARCH("test.out.*")'" .NES. "" then differences test.out $*.ok;
|
||||
-@ if "''F$SEARCH("test.out.*")'" .NES. "" then differences /par test.out $*.ok;
|
||||
-@ if "''F$SEARCH("test.out.*")'" .NES. "" then rename test.out $*.out
|
||||
-@ if "''F$SEARCH("Xdotest.*")'" .NES. "" then delete/noconfirm/nolog Xdotest.*.*
|
||||
|
||||
all : clean nolog $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_GZIP) $(SCRIPT_GDIFF)
|
||||
all : clean nolog $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_WIN) $(SCRIPT_SPELL) $(SCRIPT_GZIP) $(SCRIPT_GDIFF)
|
||||
-@ write sys$output " "
|
||||
-@ write sys$output "-----------------------------------------------"
|
||||
-@ write sys$output " All done"
|
||||
@@ -113,6 +130,8 @@ nolog :
|
||||
-@ write sys$output "MAKE_VMS.MMS options:"
|
||||
-@ write sys$output " WANT_GUI = ""$(WANT_GUI)"" "
|
||||
-@ write sys$output " WANT_UNIX = ""$(WANT_UNIX)"" "
|
||||
-@ write sys$output " WANT_WIN = ""$(WANT_WIN)"" "
|
||||
-@ write sys$output " WANT_SPELL= ""$(WANT_SPELL)"" "
|
||||
-@ write sys$output " HAVE_GZIP = ""$(HAVE_GZIP)"" "
|
||||
-@ write sys$output " HAVE_GDIFF= ""$(HAVE_GDIFF)"" "
|
||||
-@ write sys$output "Default vimrc file is VMS.VIM:
|
||||
@@ -122,5 +141,13 @@ nolog :
|
||||
clean :
|
||||
-@ if "''F$SEARCH("*.out")'" .NES. "" then delete/noconfirm/nolog *.out.*
|
||||
-@ if "''F$SEARCH("test.log")'" .NES. "" then delete/noconfirm/nolog test.log.*
|
||||
-@ if "''F$SEARCH("test.ok")'" .NES. "" then delete/noconfirm/nolog test.ok.*
|
||||
-@ if "''F$SEARCH("Xdotest.*")'" .NES. "" then delete/noconfirm/nolog Xdotest.*.*
|
||||
-@ if "''F$SEARCH("*.*_sw*")'" .NES. "" then delete/noconfirm/nolog *.*_sw*.*
|
||||
-@ if "''F$SEARCH("*.failed")'" .NES. "" then delete/noconfirm/nolog *.failed.*
|
||||
-@ if "''F$SEARCH("*.rej")'" .NES. "" then delete/noconfirm/nolog *.rej.*
|
||||
-@ if "''F$SEARCH("tiny.vim")'" .NES. "" then delete/noconfirm/nolog tiny.vim.*
|
||||
-@ if "''F$SEARCH("small.vim")'" .NES. "" then delete/noconfirm/nolog small.vim.*
|
||||
-@ if "''F$SEARCH("mbyte.vim")'" .NES. "" then delete/noconfirm/nolog mbyte.vim.*
|
||||
-@ if "''F$SEARCH("viminfo.*")'" .NES. "" then delete/noconfirm/nolog viminfo.*.*
|
||||
|
||||
|
||||
@@ -26,15 +26,17 @@ SCRIPTS_GUI = test16.out
|
||||
|
||||
.SUFFIXES: .in .out
|
||||
|
||||
nongui: nolog $(SCRIPTS)
|
||||
@echo
|
||||
@cat test.log
|
||||
@echo ALL DONE
|
||||
nongui: nolog $(SCRIPTS) report
|
||||
|
||||
gui: nolog $(SCRIPTS) $(SCRIPTS_GUI)
|
||||
gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
|
||||
|
||||
report:
|
||||
@echo
|
||||
@cat test.log
|
||||
@echo ALL DONE
|
||||
@echo 'Test results:'
|
||||
@/bin/sh -c "if test -f test.log; \
|
||||
then cat test.log; echo TEST FAILURE; exit 1; \
|
||||
else echo ALL DONE; \
|
||||
fi"
|
||||
|
||||
$(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
|
||||
|
||||
@@ -71,4 +73,4 @@ test49.out: test49.vim
|
||||
test60.out: test60.vim
|
||||
|
||||
nolog:
|
||||
-echo Test results: >test.log
|
||||
-rm -f test.log
|
||||
|
||||
@@ -24,10 +24,17 @@ STARTTEST
|
||||
:set nobin eol
|
||||
:bwipe XXUnix XXDos XXMac
|
||||
:" create mixed format files
|
||||
:!cat XXUnix XXDos >XXUxDs
|
||||
:!cat XXUnix XXMac >XXUxMac
|
||||
:!cat XXDos XXMac >XXDosMac
|
||||
:!cat XXUnix XXDos XXMac >XXUxDsMc
|
||||
:if has("vms")
|
||||
: !copy XXUnix,XXDos XXUxDs.
|
||||
: !copy XXUnix,XXMac XXUxMac.
|
||||
: !copy XXDos,XXMac XXDosMac.
|
||||
: !copy XXUnix,XXDos,XXMac XXUxDsMc.
|
||||
:else
|
||||
: !cat XXUnix XXDos >XXUxDs
|
||||
: !cat XXUnix XXMac >XXUxMac
|
||||
: !cat XXDos XXMac >XXDosMac
|
||||
: !cat XXUnix XXDos XXMac >XXUxDsMc
|
||||
:endif
|
||||
:"
|
||||
:" try reading and writing with 'fileformats' empty
|
||||
:set fileformat=unix
|
||||
|
||||
@@ -3,8 +3,13 @@ Some tests for buffer-local autocommands
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
:e xx
|
||||
:!rm -f test.out
|
||||
:au BufLeave <buffer> :!echo buffer-local autommand in %>> test.out
|
||||
:if has("vms")
|
||||
: !del test.out.*
|
||||
: au BufLeave <buffer> :!write sys$output "buffer-local autommand in %" > test.out
|
||||
:else
|
||||
: !rm -f test.out
|
||||
: au BufLeave <buffer> :!echo buffer-local autommand in %>> test.out
|
||||
:endif
|
||||
:e somefile " here, autocommand for xx shall write test.out
|
||||
: " but autocommand shall not apply to buffer named <buffer>
|
||||
:bwipe xx " here, autocommand shall be auto-deleted
|
||||
|
||||
52
src/ui.c
52
src/ui.c
@@ -2020,7 +2020,7 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
|
||||
|
||||
if (value == NULL || *length == 0)
|
||||
{
|
||||
clip_free_selection(cbd); /* ??? [what's the query?] */
|
||||
clip_free_selection(cbd); /* nothing received, clear register */
|
||||
*(int *)success = FALSE;
|
||||
return;
|
||||
}
|
||||
@@ -2076,7 +2076,7 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
|
||||
text_prop.value = (unsigned char *)value;
|
||||
text_prop.encoding = *type;
|
||||
text_prop.format = *format;
|
||||
text_prop.nitems = STRLEN(value);
|
||||
text_prop.nitems = len;
|
||||
status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
|
||||
&text_list, &n_text);
|
||||
if (status != Success || n_text < 1)
|
||||
@@ -2110,6 +2110,8 @@ clip_x11_request_selection(myShell, dpy, cbd)
|
||||
int i;
|
||||
int nbytes = 0;
|
||||
char_u *buffer;
|
||||
time_t start_time;
|
||||
int timed_out = FALSE;
|
||||
|
||||
for (i =
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -2129,6 +2131,7 @@ clip_x11_request_selection(myShell, dpy, cbd)
|
||||
case 3: type = text_atom; break;
|
||||
default: type = XA_STRING;
|
||||
}
|
||||
success = MAYBE;
|
||||
XtGetSelectionValue(myShell, cbd->sel_atom, type,
|
||||
clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
|
||||
|
||||
@@ -2141,27 +2144,48 @@ clip_x11_request_selection(myShell, dpy, cbd)
|
||||
* characters, then they will appear before the one that requested the
|
||||
* paste! Don't worry, we will catch up with any other events later.
|
||||
*/
|
||||
for (;;)
|
||||
start_time = time(NULL);
|
||||
while (success == MAYBE)
|
||||
{
|
||||
if (XCheckTypedEvent(dpy, SelectionNotify, &event))
|
||||
break;
|
||||
if (XCheckTypedEvent(dpy, SelectionRequest, &event))
|
||||
/* We may get a SelectionRequest here and if we don't handle
|
||||
* it we hang. KDE klipper does this, for example. */
|
||||
if (XCheckTypedEvent(dpy, SelectionNotify, &event)
|
||||
|| XCheckTypedEvent(dpy, SelectionRequest, &event)
|
||||
|| XCheckTypedEvent(dpy, PropertyNotify, &event))
|
||||
{
|
||||
/* This is where clip_x11_request_selection_cb() should be
|
||||
* called. It may actually happen a bit later, so we loop
|
||||
* until "success" changes.
|
||||
* We may get a SelectionRequest here and if we don't handle
|
||||
* it we hang. KDE klipper does this, for example.
|
||||
* We need to handle a PropertyNotify for large selections. */
|
||||
XtDispatchEvent(&event);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Time out after 2 to 3 seconds to avoid that we hang when the
|
||||
* other process doesn't respond. Note that the SelectionNotify
|
||||
* event may still come later when the selection owner comes back
|
||||
* to life and the text gets inserted unexpectedly. Don't know
|
||||
* why that happens or how to avoid that :-(. */
|
||||
if (time(NULL) > start_time + 2)
|
||||
{
|
||||
timed_out = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Do we need this? Probably not. */
|
||||
XSync(dpy, False);
|
||||
|
||||
/* Bernhard Walle solved a slow paste response in an X terminal by
|
||||
* adding: usleep(10000); here. */
|
||||
/* Wait for 1 msec to avoid that we eat up all CPU time. */
|
||||
ui_delay(1L, TRUE);
|
||||
}
|
||||
|
||||
/* this is where clip_x11_request_selection_cb() is actually called */
|
||||
XtDispatchEvent(&event);
|
||||
|
||||
if (success)
|
||||
if (success == TRUE)
|
||||
return;
|
||||
|
||||
/* don't do a retry with another type after timing out, otherwise we
|
||||
* hang for 15 seconds. */
|
||||
if (timed_out)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Final fallback position - use the X CUT_BUFFER0 store */
|
||||
|
||||
@@ -676,6 +676,58 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
31,
|
||||
/**/
|
||||
30,
|
||||
/**/
|
||||
29,
|
||||
/**/
|
||||
28,
|
||||
/**/
|
||||
27,
|
||||
/**/
|
||||
26,
|
||||
/**/
|
||||
25,
|
||||
/**/
|
||||
24,
|
||||
/**/
|
||||
23,
|
||||
/**/
|
||||
22,
|
||||
/**/
|
||||
21,
|
||||
/**/
|
||||
20,
|
||||
/**/
|
||||
19,
|
||||
/**/
|
||||
18,
|
||||
/**/
|
||||
17,
|
||||
/**/
|
||||
16,
|
||||
/**/
|
||||
15,
|
||||
/**/
|
||||
14,
|
||||
/**/
|
||||
13,
|
||||
/**/
|
||||
12,
|
||||
/**/
|
||||
11,
|
||||
/**/
|
||||
10,
|
||||
/**/
|
||||
9,
|
||||
/**/
|
||||
8,
|
||||
/**/
|
||||
7,
|
||||
/**/
|
||||
6,
|
||||
/**/
|
||||
5,
|
||||
/**/
|
||||
|
||||
@@ -1728,7 +1728,8 @@ typedef int proftime_T; /* dummy for function prototypes */
|
||||
#define VV_MOUSE_COL 51
|
||||
#define VV_OP 52
|
||||
#define VV_SEARCHFORWARD 53
|
||||
#define VV_LEN 54 /* number of v: vars */
|
||||
#define VV_OLDFILES 54
|
||||
#define VV_LEN 55 /* number of v: vars */
|
||||
|
||||
#ifdef FEAT_CLIPBOARD
|
||||
|
||||
@@ -2054,4 +2055,10 @@ typedef int VimClipboard; /* This is required for the prototypes. */
|
||||
#define DOSO_VIMRC 1 /* loading vimrc file */
|
||||
#define DOSO_GVIMRC 2 /* loading gvimrc file */
|
||||
|
||||
/* flags for read_viminfo() and children */
|
||||
#define VIF_WANT_INFO 1 /* load non-mark info */
|
||||
#define VIF_WANT_MARKS 2 /* load file marks */
|
||||
#define VIF_FORCEIT 4 /* overwrite info already read */
|
||||
#define VIF_GET_OLDFILES 8 /* load v:oldfiles */
|
||||
|
||||
#endif /* VIM__H */
|
||||
|
||||
Reference in New Issue
Block a user