Compare commits

..

26 Commits

Author SHA1 Message Date
Bram Moolenaar
373154b00c updated for version 7.0-195 2007-02-13 05:19:30 +00:00
Bram Moolenaar
ad40f02cd9 updated for version 7.0-194 2007-02-13 03:01:39 +00:00
Bram Moolenaar
b01a8b749b updated for version 7.0-193 2007-02-13 02:47:22 +00:00
Bram Moolenaar
47b8b15b5f updated for version 7.0-192 2007-02-07 02:41:57 +00:00
Bram Moolenaar
48b66fb5a7 updated for version 7.0-191 2007-02-04 01:58:18 +00:00
Bram Moolenaar
86ea76404e updated for version 7.0-190 2007-02-04 01:48:10 +00:00
Bram Moolenaar
0739a1e671 updated for version 7.0-189 2007-02-04 01:37:39 +00:00
Bram Moolenaar
8c471fa0b3 updated for version 7.0-188 2007-01-16 21:14:45 +00:00
Bram Moolenaar
8dd1aa58ad updated for version 7.0-187 2007-01-16 20:33:19 +00:00
Bram Moolenaar
fb7c90c0fa updated for version 7.0-186 2007-01-16 15:01:41 +00:00
Bram Moolenaar
56da797e6d updated for version 7.0-185 2007-01-16 14:46:32 +00:00
Bram Moolenaar
84c4d79ad4 updated for version 7.0-184 2007-01-16 14:18:41 +00:00
Bram Moolenaar
863b53b72e updated for version 7.0-183 2007-01-14 14:28:34 +00:00
Bram Moolenaar
89ed3dfd87 updated for version 7.0-182 2007-01-09 19:23:12 +00:00
Bram Moolenaar
9460b9d215 updated for version 7.0-181 2007-01-09 14:37:01 +00:00
Bram Moolenaar
d675e2c513 updated for version 7.0-180 2007-01-09 14:09:25 +00:00
Bram Moolenaar
df88dda91c updated for version 7.0-179 2007-01-09 13:34:50 +00:00
Bram Moolenaar
201863f75d updated for version 7.0-178 2006-12-05 21:06:46 +00:00
Bram Moolenaar
cf8e7d14aa updated for version 7.0-177 2006-12-05 20:43:17 +00:00
Bram Moolenaar
9c4b4ab3a6 updated for version 7.0-176 2006-12-05 20:29:56 +00:00
Bram Moolenaar
61b974b9ee updated for version 7.0-175 2006-12-05 09:32:29 +00:00
Bram Moolenaar
3b1b6c6259 updated for version 7.0-174 2006-11-28 20:40:00 +00:00
Bram Moolenaar
f278987c97 updated for version 7.0-173 2006-11-28 19:54:04 +00:00
Bram Moolenaar
4632d298ad updated for version 7.0-172 2006-11-28 17:36:37 +00:00
Bram Moolenaar
3d20ca1ad1 updated for version 7.0-171 2006-11-28 16:43:58 +00:00
Bram Moolenaar
85f868c3ae updated for version 7.0-170 2006-11-28 16:16:58 +00:00
29 changed files with 400 additions and 135 deletions

View File

@@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 7.0. Last change: 2006 May 06
*autocmd.txt* For Vim version 7.0. Last change: 2007 Jan 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -279,6 +279,7 @@ Name triggered by ~
|FuncUndefined| a user function is used but it isn't defined
|SpellFileMissing| a spell file is used but it can't be found
|SourcePre| before sourcing a Vim script
|SourceCmd| before sourcing a Vim script |Cmd-event|
|VimResized| after the Vim window size changed
|FocusGained| Vim got input focus
@@ -690,10 +691,17 @@ ShellFilterPost After executing a shell command with
Can be used to check for any changed files.
*SourcePre*
SourcePre Before sourcing a Vim script. |:source|
<afile> is the name of the file being sourced.
*SourceCmd*
SourceCmd When sourcing a Vim script. |:source|
<afile> is the name of the file being sourced.
The autocommand must source this file.
|Cmd-event|
*SpellFileMissing*
SpellFileMissing When trying to load a spell checking file and
it can't be found. <amatch> is the language,
'encoding' also matters. See
it can't be found. The pattern is matched
against the language. <amatch> is the
language, 'encoding' also matters. See
|spell-SpellFileMissing|.
*StdinReadPost*
StdinReadPost After reading from the stdin into the buffer,
@@ -1219,8 +1227,8 @@ highlighting when starting Vim.
*Cmd-event*
When using one of the "*Cmd" events, the matching autocommands are expected to
do the file reading or writing. This can be used when working with a special
kind of file, for example on a remote system.
do the file reading, writing or sourcing. This can be used when working with
a special kind of file, for example on a remote system.
CAREFUL: If you use these events in a wrong way, it may have the effect of
making it impossible to read or write the matching files! Make sure you test
your autocommands properly. Best is to use a pattern that will never match a
@@ -1233,9 +1241,10 @@ possible with a BufReadCmd, use the |:preserve| command to make sure the
original file isn't needed for recovery. You might want to do this only when
you expect the file to be modified.
The |v:cmdarg| variable holds the "++enc=" and "++ff=" argument that are
effective. These should be used for the command that reads/writes the file.
The |v:cmdbang| variable is one when "!" was used, zero otherwise.
For file read and write commands the |v:cmdarg| variable holds the "++enc="
and "++ff=" argument that are effective. These should be used for the command
that reads/writes the file. The |v:cmdbang| variable is one when "!" was
used, zero otherwise.
See the $VIMRUNTIME/plugin/netrw.vim for examples.

View File

@@ -2897,12 +2897,14 @@ getqflist() *getqflist()*
vcol non-zero: "col" is visual column
zero: "col" is byte index
nr error number
pattern search pattern used to locate the error
text description of the error
type type of the error, 'E', '1', etc.
valid non-zero: recognized error message
When there is no error list or it's empty an empty list is
returned.
returned. Quickfix list entries with non-existing buffer
number are returned with "bufnr" set to zero.
Useful application: Find pattern matches in multiple files and
do something with them: >
@@ -4371,7 +4373,10 @@ setqflist({list} [, {action}]) *setqflist()*
Non-dictionary items in {list} are ignored. Each dictionary
item can contain the following entries:
filename name of a file
bufnr buffer number; must be the number of a valid
buffer
filename name of a file; only used when "bufnr" is not
present or it is invalid.
lnum line number in the file
pattern search pattern used to locate the error
col column number
@@ -4384,11 +4389,13 @@ setqflist({list} [, {action}]) *setqflist()*
The "col", "vcol", "nr", "type" and "text" entries are
optional. Either "lnum" or "pattern" entry can be used to
locate a matching error line.
If the "filename" entry is not present or neither the "lnum"
or "pattern" entries are present, then the item will not be
handled as an error line.
If the "filename" and "bufnr" entries are not present or
neither the "lnum" or "pattern" entries are present, then the
item will not be handled as an error line.
If both "pattern" and "lnum" are present then "pattern" will
be used.
Note that the list is not exactly the same as what
|getqflist()| returns.
If {action} is set to 'a', then the items from {list} are
added to the existing quickfix list. If there is no existing

View File

@@ -384,7 +384,7 @@ endif
" Programming menu
if !exists("g:ctags_command")
if has("vms")
let g:ctags_command = "mc vim:ctags ."
let g:ctags_command = "mc vim:ctags *.*"
else
let g:ctags_command = "ctags -R ."
endif

View File

@@ -2,7 +2,7 @@
# Makefile for Vim on OpenVMS
#
# Maintainer: Zoltan Arpadffy <arpadffy@polarhome.com>
# Last change: 2006 Apr 30
# Last change: 2006 Sep 04
#
# This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64
# with MMS and MMK
@@ -13,7 +13,7 @@
#
# Edit the lines in the Configuration section below for fine tuning.
#
# To build: mms/descrip=Make_vms.mms
# To build: mms/descrip=Make_vms.mms /ignore=warning
# To clean up: mms/descrip=Make_vms.mms clean
#
# Hints and detailed description could be found in INSTALLVMS.TXT file.
@@ -21,10 +21,6 @@
######################################################################
# Configuration section.
######################################################################
# Platform selection
# Define this if you will use the VAX platform to build.
# VAX = YES
# VMS version
# Uncomment if you use VMS version 6.2 or older
# OLD_VMS = YES
@@ -49,6 +45,7 @@ GUI = YES
# GUI with GTK
# If you have GTK installed you might want to enable this option.
# NOTE: you will need to properly define GTK_DIR below
# GTK = YES
# GUI/Motif with XPM
@@ -97,7 +94,7 @@ CCVER = YES
# Compiler setup
.IFDEF VAX
.IFDEF MMSVAX
.IFDEF DECC # VAX with DECC
CC_DEF = cc # /decc # some system requires this switch
# but when it is not required /ver might fail
@@ -165,8 +162,8 @@ GTK = ""
# NOTE: you need to set up your GTK_DIR (GTK root directory), because it is
# unique on every system - logicals are not accepted
# please note: directory should end with . in order to /trans=conc work
# Example: GTK_DIR = $1$DGA104:[USERS.ZAY.WORK.GTK1210.]
GTK_DIR = DKA0:[GTK1210.]
# This value for GTK_DIR is an example.
GTK_DIR = $1$DGA104:[USERS.ZAY.WORK.GTK1210.]
DEFS = "HAVE_CONFIG_H","FEAT_GUI_GTK"
LIBS = ,OS_VMS_GTK.OPT/OPT
GUI_FLAG = /name=(as_is,short)/float=ieee/ieee=denorm
@@ -274,7 +271,6 @@ TAG_DEF = ,"FEAT_TAG_ANYWHITE"
# Please, do not change anything below without programming experience.
######################################################################
MODEL_DEF = "FEAT_$(MODEL)",
# These go into pathdef.c
@@ -360,7 +356,8 @@ pathdef.c : check_ccver $(CONFIG_H)
-@ write pd "char_u *all_lflags = (char_u *)""$(LD_DEF)$(LDFLAGS) /exe=$(TARGET) *.OBJ $(ALL_LIBS)"";"
-@ write pd "char_u *compiler_version = (char_u *) ""''CC_VER'"";"
-@ write pd "char_u *compiled_user = (char_u *) "$(VIMUSER)";"
-@ write pd "char_u *compiled_sys = (char_u *) "$(VIMHOST)";"
-@ write pd "char_u *compiled_sys = (char_u *) "$(VIMHOST)";"
-@ write pd "char_u *compiled_arch = (char_u *) ""$(MMSARCH_NAME)"";"
-@ close pd
if_perl.c : if_perl.xs

View File

@@ -4145,11 +4145,13 @@ fix_fname(fname)
/*
* Force expanding the path always for Unix, because symbolic links may
* mess up the full path name, even though it starts with a '/'.
* Also expand always for VMS, it may have alternate paths that need to be
* resolved.
* Also expand when there is ".." in the file name, try to remove it,
* because "c:/src/../README" is equal to "c:/README".
* For MS-Windows also expand names like "longna~1" to "longname".
*/
#ifdef UNIX
#if defined(UNIX) || defined(VMS)
return FullName_save(fname, TRUE);
#else
if (!vim_isAbsName(fname) || strstr((char *)fname, "..") != NULL

View File

@@ -4970,16 +4970,18 @@ ins_complete(c)
* just a safety check. */
if (compl_curr_match->cp_number != -1)
{
/* Space for 10 text chars. + 2x10-digit no.s */
static char_u match_ref[31];
/* Space for 10 text chars. + 2x10-digit no.s = 31.
* Translations may need more than twice that. */
static char_u match_ref[81];
if (compl_matches > 0)
sprintf((char *)IObuff, _("match %d of %d"),
vim_snprintf((char *)match_ref, sizeof(match_ref),
_("match %d of %d"),
compl_curr_match->cp_number, compl_matches);
else
sprintf((char *)IObuff, _("match %d"),
compl_curr_match->cp_number);
vim_strncpy(match_ref, IObuff, 30);
vim_snprintf((char *)match_ref, sizeof(match_ref),
_("match %d"),
compl_curr_match->cp_number);
edit_submode_extra = match_ref;
edit_submode_highl = HLF_R;
if (dollar_vcol)

View File

@@ -898,6 +898,7 @@ set_internal_string_var(name, value)
}
static lval_T *redir_lval = NULL;
static garray_T redir_ga; /* only valid when redir_lval is not NULL */
static char_u *redir_endp = NULL;
static char_u *redir_varname = NULL;
@@ -932,6 +933,9 @@ var_redir_start(name, append)
return FAIL;
}
/* The output is stored in growarray "redir_ga" until redirection ends. */
ga_init2(&redir_ga, (int)sizeof(char), 500);
/* Parse the variable name (can be a dict or list entry). */
redir_endp = get_lval(redir_varname, NULL, redir_lval, FALSE, FALSE, FALSE,
FNE_CHECK_START);
@@ -974,42 +978,36 @@ var_redir_start(name, append)
}
/*
* Append "value[len]" to the variable set by var_redir_start().
* Append "value[value_len]" to the variable set by var_redir_start().
* The actual appending is postponed until redirection ends, because the value
* appended may in fact be the string we write to, changing it may cause freed
* memory to be used:
* :redir => foo
* :let foo
* :redir END
*/
void
var_redir_str(value, len)
var_redir_str(value, value_len)
char_u *value;
int len;
int value_len;
{
char_u *val;
typval_T tv;
int save_emsg;
int err;
size_t len;
if (redir_lval == NULL)
return;
if (len == -1)
/* Append the entire string */
val = vim_strsave(value);
if (value_len == -1)
len = STRLEN(value); /* Append the entire string */
else
/* Append only the specified number of characters */
val = vim_strnsave(value, len);
if (val == NULL)
return;
len = value_len; /* Append only "value_len" characters */
tv.v_type = VAR_STRING;
tv.vval.v_string = val;
save_emsg = did_emsg;
did_emsg = FALSE;
set_var_lval(redir_lval, redir_endp, &tv, FALSE, (char_u *)".");
err = did_emsg;
did_emsg |= save_emsg;
if (err)
if (ga_grow(&redir_ga, (int)len) == OK)
{
mch_memmove((char *)redir_ga.ga_data + redir_ga.ga_len, value, len);
redir_ga.ga_len += len;
}
else
var_redir_stop();
vim_free(tv.vval.v_string);
}
/*
@@ -1018,8 +1016,19 @@ var_redir_str(value, len)
void
var_redir_stop()
{
typval_T tv;
if (redir_lval != NULL)
{
/* Append the trailing NUL. */
ga_append(&redir_ga, NUL);
/* Assign the text to the variable. */
tv.v_type = VAR_STRING;
tv.vval.v_string = redir_ga.ga_data;
set_var_lval(redir_lval, redir_endp, &tv, FALSE, (char_u *)".");
vim_free(tv.vval.v_string);
clear_lval(redir_lval);
vim_free(redir_lval);
redir_lval = NULL;
@@ -3184,9 +3193,18 @@ ex_call(eap)
failed = TRUE;
break;
}
/* Handle a function returning a Funcref, Dictionary or List. */
if (handle_subscript(&arg, &rettv, !eap->skip, TRUE) == FAIL)
{
failed = TRUE;
break;
}
clear_tv(&rettv);
if (doesrange || eap->skip)
break;
/* Stop when immediately aborting on error, or when an interrupt
* occurred or an exception was thrown but not caught.
* get_func_tv() returned OK, so that the check for trailing
@@ -16064,6 +16082,10 @@ error:
}
}
/* add a terminating NUL */
ga_grow(&ga, 1);
ga_append(&ga, NUL);
rettv->vval.v_string = ga.ga_data;
}

View File

@@ -6967,6 +6967,14 @@ ex_drop(eap)
*/
set_arglist(eap->arg);
/*
* Expanding wildcards may result in an empty argument list. E.g. when
* editing "foo.pyc" and ".pyc" is in 'wildignore'. Assume that we
* already did an error message for this.
*/
if (ARGCOUNT == 0)
return;
# ifdef FEAT_WINDOWS
if (cmdmod.tab)
{

View File

@@ -1242,14 +1242,22 @@ autowrite(buf, forceit)
buf_T *buf;
int forceit;
{
int r;
if (!(p_aw || p_awa) || !p_write
#ifdef FEAT_QUICKFIX
/* never autowrite a "nofile" or "nowrite" buffer */
|| bt_dontwrite(buf)
/* never autowrite a "nofile" or "nowrite" buffer */
|| bt_dontwrite(buf)
#endif
|| (!forceit && buf->b_p_ro) || buf->b_ffname == NULL)
|| (!forceit && buf->b_p_ro) || buf->b_ffname == NULL)
return FAIL;
return buf_write_all(buf, forceit);
r = buf_write_all(buf, forceit);
/* Writing may succeed but the buffer still changed, e.g., when there is a
* conversion error. We do want to return FAIL then. */
if (buf_valid(buf) && bufIsChanged(buf))
r = FAIL;
return r;
}
/*
@@ -1472,6 +1480,8 @@ check_changed_any(hidden)
if (buf == NULL) /* No buffers changed */
return FALSE;
/* Try auto-writing the buffer. If this fails but the buffer no
* longer exists it's not changed, that's OK. */
if (check_changed(buf, p_awa, TRUE, FALSE, TRUE) && buf_valid(buf))
break; /* didn't save - still changes */
}
@@ -2811,6 +2821,17 @@ do_source(fname, check_other, is_vimrc)
}
#ifdef FEAT_AUTOCMD
/* Apply SourceCmd autocommands, they should get the file and source it. */
if (has_autocmd(EVENT_SOURCECMD, fname_exp, NULL)
&& apply_autocmds(EVENT_SOURCECMD, fname_exp, fname_exp,
FALSE, curbuf))
# ifdef FEAT_EVAL
return aborting() ? FAIL : OK;
# else
return OK;
# endif
/* Apply SourcePre autocommands, they may get the file. */
apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf);
#endif

View File

@@ -9675,6 +9675,7 @@ makeopens(fd, dirnow)
win_T *edited_win = NULL;
int tabnr;
win_T *tab_firstwin;
frame_T *tab_topframe;
if (ssop_flags & SSOP_BUFFERS)
only_save_windows = FALSE; /* Save ALL buffers */
@@ -9786,6 +9787,7 @@ makeopens(fd, dirnow)
* autocommands.
*/
tab_firstwin = firstwin; /* first window in tab page "tabnr" */
tab_topframe = topframe;
for (tabnr = 1; ; ++tabnr)
{
int need_tabnew = FALSE;
@@ -9797,9 +9799,15 @@ makeopens(fd, dirnow)
if (tp == NULL)
break; /* done all tab pages */
if (tp == curtab)
{
tab_firstwin = firstwin;
tab_topframe = topframe;
}
else
{
tab_firstwin = tp->tp_firstwin;
tab_topframe = tp->tp_topframe;
}
if (tabnr > 1)
need_tabnew = TRUE;
}
@@ -9838,7 +9846,7 @@ makeopens(fd, dirnow)
*/
if (put_line(fd, "set splitbelow splitright") == FAIL)
return FAIL;
if (ses_win_rec(fd, topframe) == FAIL)
if (ses_win_rec(fd, tab_topframe) == FAIL)
return FAIL;
if (!p_sb && put_line(fd, "set nosplitbelow") == FAIL)
return FAIL;

View File

@@ -340,7 +340,7 @@ do_errthrow(cstack, cmdname)
/* If no exception is to be thrown or the conversion should be done after
* returning to a previous invocation of do_one_cmd(), do nothing. */
if (*msg_list == NULL)
if (msg_list == NULL || *msg_list == NULL)
return;
if (throw_exception(*msg_list, ET_ERROR, cmdname) == FAIL)
@@ -2026,8 +2026,11 @@ leave_cleanup(csp)
/* If an error was about to be converted to an exception when
* enter_cleanup() was called, free the message list. */
free_msglist(*msg_list);
*msg_list = NULL;
if (msg_list != NULL)
{
free_msglist(*msg_list);
*msg_list = NULL;
}
}
/*

View File

@@ -6178,8 +6178,8 @@ move_lines(frombuf, tobuf)
if (retval != FAIL)
{
curbuf = frombuf;
while (!bufempty())
if (ml_delete(curbuf->b_ml.ml_line_count, FALSE) == FAIL)
for (lnum = curbuf->b_ml.ml_line_count; lnum > 0; --lnum)
if (ml_delete(lnum, FALSE) == FAIL)
{
/* Oops! We could try putting back the saved lines, but that
* might fail again... */
@@ -7019,6 +7019,7 @@ static struct event_name
{"ShellCmdPost", EVENT_SHELLCMDPOST},
{"ShellFilterPost", EVENT_SHELLFILTERPOST},
{"SourcePre", EVENT_SOURCEPRE},
{"SourceCmd", EVENT_SOURCECMD},
{"SpellFileMissing",EVENT_SPELLFILEMISSING},
{"StdinReadPost", EVENT_STDINREADPOST},
{"StdinReadPre", EVENT_STDINREADPRE},

View File

@@ -76,7 +76,7 @@ static int maphash_valid = FALSE;
*/
static mapblock_T *first_abbr = NULL; /* first entry in abbrlist */
static int KeyNoremap = FALSE; /* remapping disabled */
static int KeyNoremap = 0; /* remapping flags */
/*
* variables used by vgetorpeek() and flush_buffers()
@@ -1035,6 +1035,8 @@ ins_typebuf(str, noremap, offset, nottyped, silent)
/*
* Put character "c" back into the typeahead buffer.
* Can be used for a character obtained by vgetc() that needs to be put back.
* Uses cmd_silent, KeyTyped and KeyNoremap to restore the flags belonging to
* the char.
*/
void
ins_char_typebuf(c)
@@ -1061,7 +1063,7 @@ ins_char_typebuf(c)
buf[1] = NUL;
#endif
}
(void)ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE);
(void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
}
/*
@@ -2270,9 +2272,8 @@ vgetorpeek(advance)
gotchars(typebuf.tb_buf
+ typebuf.tb_off, 1);
}
KeyNoremap = (typebuf.tb_noremap[
typebuf.tb_off]
& (RM_NONE|RM_SCRIPT));
KeyNoremap = typebuf.tb_noremap[
typebuf.tb_off];
del_typebuf(1, 0);
}
break; /* got character, break for loop */
@@ -4196,7 +4197,8 @@ check_abbr(c, ptr, col, mincol)
if (typebuf.tb_no_abbr_cnt) /* abbrev. are not recursive */
return FALSE;
if (KeyNoremap) /* no remapping implies no abbreviation */
if ((KeyNoremap & (RM_NONE|RM_SCRIPT)) != 0)
/* no remapping implies no abbreviation */
return FALSE;
/*

View File

@@ -555,6 +555,10 @@ EXTERN buf_T *firstbuf INIT(= NULL); /* first buffer */
EXTERN buf_T *lastbuf INIT(= NULL); /* last buffer */
EXTERN buf_T *curbuf INIT(= NULL); /* currently active buffer */
/* Flag that is set when switching off 'swapfile'. It means that all blocks
* are to be loaded into memory. Shouldn't be global... */
EXTERN int mf_dont_release INIT(= FALSE); /* don't release blocks */
/*
* List of files being edited (global argument list). curwin->w_alist points
* to this when the window is using the global argument list.
@@ -1092,6 +1096,7 @@ extern char_u *all_cflags;
extern char_u *all_lflags;
# ifdef VMS
extern char_u *compiler_version;
extern char_u *compiled_arch;
# endif
extern char_u *compiled_user;
extern char_u *compiled_sys;

View File

@@ -2405,8 +2405,7 @@ gui_mch_update_tabline(void)
tiw.mask = TCIF_TEXT;
tiw.iImage = -1;
tiw.pszText = wstr;
SendMessage(s_tabhwnd, TCM_INSERTITEMW, (WPARAM)nr,
(LPARAM)&tiw);
SendMessage(s_tabhwnd, TCM_SETITEMW, (WPARAM)nr, (LPARAM)&tiw);
vim_free(wstr);
}
}
@@ -3033,13 +3032,25 @@ gui_mch_init_font(char_u *font_name, int fontset)
return OK;
}
#ifndef WPF_RESTORETOMAXIMIZED
# define WPF_RESTORETOMAXIMIZED 2 /* just in case someone doesn't have it */
#endif
/*
* Return TRUE if the GUI window is maximized, filling the whole screen.
*/
int
gui_mch_maximized()
{
return IsZoomed(s_hwnd);
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
if (GetWindowPlacement(s_hwnd, &wp))
return wp.showCmd == SW_SHOWMAXIMIZED
|| (wp.showCmd == SW_SHOWMINIMIZED
&& wp.flags == WPF_RESTORETOMAXIMIZED);
return 0;
}
/*

View File

@@ -627,10 +627,11 @@ cs_cnt_matches(idx)
* If the database is out of date, or there's some other problem,
* cscope will output error messages before the number-of-lines output.
* Display/discard any output that doesn't match what we want.
* Accept "\S*cscope: X lines", also matches "mlcscope".
*/
if ((stok = strtok(buf, (const char *)" ")) == NULL)
continue;
if (strcmp((const char *)stok, "cscope:"))
if (strstr((const char *)stok, "cscope:") == NULL)
continue;
if ((stok = strtok(NULL, (const char *)" ")) == NULL)

View File

@@ -2294,8 +2294,14 @@ mb_strnicmp(s1, s2, nn)
}
/* Check directly first, it's faster. */
for (j = 0; j < l; ++j)
{
if (s1[i + j] != s2[i + j])
break;
if (s1[i + j] == 0)
/* Both stings have the same bytes but are incomplete or
* have illegal bytes, accept them as equal. */
l = j;
}
if (j < l)
{
/* If one of the two characters is incomplete return -1. */

View File

@@ -76,7 +76,6 @@ extern int dos2; /* this is in os_amiga.c */
#define MEMFILE_PAGE_SIZE 4096 /* default page size */
static long_u total_mem_used = 0; /* total memory used for memfiles */
static int dont_release = FALSE; /* don't release blocks */
static void mf_ins_hash __ARGS((memfile_T *, bhdr_T *));
static void mf_rem_hash __ARGS((memfile_T *, bhdr_T *));
@@ -279,10 +278,10 @@ mf_close_file(buf, getlines)
if (getlines)
{
/* get all blocks in memory by accessing all lines (clumsy!) */
dont_release = TRUE;
mf_dont_release = TRUE;
for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum)
(void)ml_get_buf(buf, lnum, FALSE);
dont_release = FALSE;
mf_dont_release = FALSE;
/* TODO: should check if all blocks are really in core */
}
@@ -830,7 +829,7 @@ mf_release(mfp, page_count)
buf_T *buf;
/* don't release while in mf_close_file() */
if (dont_release)
if (mf_dont_release)
return NULL;
/*

View File

@@ -1329,8 +1329,11 @@ theend:
mf_put(mfp, hp, FALSE, FALSE);
mf_close(mfp, FALSE); /* will also vim_free(mfp->mf_fname) */
}
vim_free(buf->b_ml.ml_stack);
vim_free(buf);
if (buf != NULL)
{
vim_free(buf->b_ml.ml_stack);
vim_free(buf);
}
if (serious_error && called_from_main)
ml_close(curbuf, TRUE);
#ifdef FEAT_AUTOCMD
@@ -2051,13 +2054,21 @@ ml_get_buf(buf, lnum, will_change)
linenr_T lnum;
int will_change; /* line will be changed */
{
bhdr_T *hp;
DATA_BL *dp;
char_u *ptr;
bhdr_T *hp;
DATA_BL *dp;
char_u *ptr;
static int recursive = 0;
if (lnum > buf->b_ml.ml_line_count) /* invalid line number */
{
EMSGN(_("E315: ml_get: invalid lnum: %ld"), lnum);
if (recursive == 0)
{
/* Avoid giving this message for a recursive call, may happen when
* the GUI redraws part of the text. */
++recursive;
EMSGN(_("E315: ml_get: invalid lnum: %ld"), lnum);
--recursive;
}
errorret:
STRCPY(IObuff, "???");
return IObuff;
@@ -2071,8 +2082,10 @@ errorret:
/*
* See if it is the same line as requested last time.
* Otherwise may need to flush last used line.
* Don't use the last used line when 'swapfile' is reset, need to load all
* blocks.
*/
if (buf->b_ml.ml_line_lnum != lnum)
if (buf->b_ml.ml_line_lnum != lnum || mf_dont_release)
{
ml_flush_line(buf);
@@ -2083,7 +2096,14 @@ errorret:
*/
if ((hp = ml_find_line(buf, lnum, ML_FIND)) == NULL)
{
EMSGN(_("E316: ml_get: cannot find line %ld"), lnum);
if (recursive == 0)
{
/* Avoid giving this message for a recursive call, may happen
* when the GUI redraws part of the text. */
++recursive;
EMSGN(_("E316: ml_get: cannot find line %ld"), lnum);
--recursive;
}
goto errorret;
}
@@ -3197,13 +3217,16 @@ ml_find_line(buf, lnum, action)
* If not, flush and release the locked block.
* Don't do this for ML_INSERT_SAME, because the stack need to be updated.
* Don't do this for ML_FLUSH, because we want to flush the locked block.
* Don't do this when 'swapfile' is reset, we want to load all the blocks.
*/
if (buf->b_ml.ml_locked)
{
if (ML_SIMPLE(action) && buf->b_ml.ml_locked_low <= lnum
&& buf->b_ml.ml_locked_high >= lnum)
if (ML_SIMPLE(action)
&& buf->b_ml.ml_locked_low <= lnum
&& buf->b_ml.ml_locked_high >= lnum
&& !mf_dont_release)
{
/* remember to update pointer blocks and stack later */
/* remember to update pointer blocks and stack later */
if (action == ML_INSERT)
{
++(buf->b_ml.ml_locked_lineadd);
@@ -3569,8 +3592,9 @@ makeswapname(fname, ffname, buf, dir_name)
#else
(buf->b_p_sn || buf->b_shortname),
#endif
#ifdef RISCOS
/* Avoid problems if fname has special chars, eg <Wimp$Scrap> */
#if defined(VMS) || defined(RISCOS)
/* Avoid problems if fname has special chars, eg <Wimp$Scrap>.
* For VMS always use full path for swapfile. */
ffname,
#else
# ifdef HAVE_READLINK

View File

@@ -2246,7 +2246,7 @@ ex_emenu(eap)
{
/* When executing a script or function execute the commands right now.
* Otherwise put them in the typeahead buffer. */
#ifdef FEAT_En
#ifdef FEAT_EVAL
if (current_SID != 0)
exec_normal_cmd(menu->strings[idx], menu->noremap[idx],
menu->silent[idx]);

View File

@@ -1556,7 +1556,7 @@ msg_prt_line(s, list)
int c_extra = 0;
char_u *p_extra = NULL; /* init to make SASC shut up */
int n;
int attr= 0;
int attr = 0;
char_u *trail = NULL;
#ifdef FEAT_MBYTE
int l;
@@ -1581,7 +1581,7 @@ msg_prt_line(s, list)
while (!got_int)
{
if (n_extra)
if (n_extra > 0)
{
--n_extra;
if (c_extra)
@@ -1595,7 +1595,7 @@ msg_prt_line(s, list)
col += (*mb_ptr2cells)(s);
mch_memmove(buf, s, (size_t)l);
buf[l] = NUL;
msg_puts_attr(buf, attr);
msg_puts(buf);
s += l;
continue;
}
@@ -1635,6 +1635,9 @@ msg_prt_line(s, list)
p_extra = transchar_byte(c);
c_extra = NUL;
c = *p_extra++;
/* Use special coloring to be able to distinguish <hex> from
* the same in plain text. */
attr = hl_attr(HLF_8);
}
else if (c == ' ' && trail != NULL && s > trail)
{

View File

@@ -651,9 +651,8 @@ normal_cmd(oap, toplevel)
/* Fake a "c"hange command. When "restart_edit" is set (e.g., because
* 'insertmode' is set) fake a "d"elete command, Insert mode will
* restart automatically.
* Insert the typed character in the typeahead buffer, so that it will
* be mapped in Insert mode. Required for ":lmap" to work. May cause
* mapping a character from ":vnoremap"... */
* Insert the typed character in the typeahead buffer, so that it can
* be mapped in Insert mode. Required for ":lmap" to work. */
ins_char_typebuf(c);
if (restart_edit != 0)
c = 'd';

View File

@@ -2202,7 +2202,7 @@ slash_adjust(p)
#endif
/*
* Get absolute file name into buffer 'buf' of length 'len' bytes.
* Get absolute file name into "buf[len]".
*
* return FAIL for failure, OK for success
*/
@@ -2212,22 +2212,49 @@ mch_FullName(fname, buf, len, force)
int len;
int force; /* also expand when already absolute path */
{
#ifdef VMS
/*
* VMS does this in a completely different way.
*
* By default a file found in a complex path is written to the first
* directory in the path and not to the original directory. This
* behaviour should be avoided for the existing files and we need to find
* the exact path of the edited file.
*/
{
char_u *fixed_fname = vms_fixfilename(fname);
int fd = mch_open((char *)fixed_fname, O_RDONLY | O_EXTRA, 0);
if (fd > 0)
{
char nbuf[MAXNAMLEN];
/* File exists, use getname() to get the real name. */
if (getname(fd, nbuf))
vim_strncpy(fixed_fname, (char_u *)nbuf, (size_t)(len - 1));
close(fd);
}
if (STRLEN(fixed_fname) >= len)
return FAIL;
STRCPY(buf, fixed_fname);
}
#else /* not VMS */
int l;
#ifdef OS2
# ifdef OS2
int only_drive; /* file name is only a drive letter */
#endif
#ifdef HAVE_FCHDIR
# endif
# ifdef HAVE_FCHDIR
int fd = -1;
static int dont_fchdir = FALSE; /* TRUE when fchdir() doesn't work */
#endif
# endif
char_u olddir[MAXPATHL];
char_u *p;
int retval = OK;
#ifdef VMS
fname = vms_fixfilename(fname);
#endif
/* expand it if forced or not an absolute path */
if (force || !mch_isFullName(fname))
{
@@ -2236,16 +2263,16 @@ mch_FullName(fname, buf, len, force)
* and then do the getwd() (and get back to where we were).
* This will get the correct path name with "../" things.
*/
#ifdef OS2
# ifdef OS2
only_drive = 0;
if (((p = vim_strrchr(fname, '/')) != NULL)
|| ((p = vim_strrchr(fname, '\\')) != NULL)
|| (((p = vim_strchr(fname, ':')) != NULL) && ++only_drive))
#else
# else
if ((p = vim_strrchr(fname, '/')) != NULL)
#endif
# endif
{
#ifdef HAVE_FCHDIR
# ifdef HAVE_FCHDIR
/*
* Use fchdir() if possible, it's said to be faster and more
* reliable. But on SunOS 4 it might not work. Check this by
@@ -2261,14 +2288,14 @@ mch_FullName(fname, buf, len, force)
dont_fchdir = TRUE; /* don't try again */
}
}
#endif
# endif
/* Only change directory when we are sure we can return to where
* we are now. After doing "su" chdir(".") might not work. */
if (
#ifdef HAVE_FCHDIR
# ifdef HAVE_FCHDIR
fd < 0 &&
#endif
# endif
(mch_dirname(olddir, MAXPATHL) == FAIL
|| mch_chdir((char *)olddir) != 0))
{
@@ -2277,7 +2304,7 @@ mch_FullName(fname, buf, len, force)
}
else
{
#ifdef OS2
# ifdef OS2
/*
* compensate for case where ':' from "D:" was the only
* path separator detected in the file name; the _next_
@@ -2285,7 +2312,7 @@ mch_FullName(fname, buf, len, force)
*/
if (only_drive)
p++;
#endif
# endif
/* The directory is copied into buf[], to be able to remove
* the file name without changing it (could be a string in
* read-only memory) */
@@ -2300,14 +2327,14 @@ mch_FullName(fname, buf, len, force)
fname = p + 1;
*buf = NUL;
}
#ifdef OS2
# ifdef OS2
if (only_drive)
{
p--;
if (retval != FAIL)
fname--;
}
#endif
# endif
}
}
if (mch_dirname(buf, len) == FAIL)
@@ -2317,14 +2344,14 @@ mch_FullName(fname, buf, len, force)
}
if (p != NULL)
{
#ifdef HAVE_FCHDIR
# ifdef HAVE_FCHDIR
if (fd >= 0)
{
l = fchdir(fd);
close(fd);
}
else
#endif
# endif
l = mch_chdir((char *)olddir);
if (l != 0)
EMSG(_(e_prev_dir));
@@ -2333,15 +2360,14 @@ mch_FullName(fname, buf, len, force)
l = STRLEN(buf);
if (l >= len)
retval = FAIL;
#ifndef VMS
else
{
if (l > 0 && buf[l - 1] != '/' && *fname != NUL
&& STRCMP(fname, ".") != 0)
STRCAT(buf, "/");
}
#endif
}
/* Catch file names which are too long. */
if (retval == FAIL || STRLEN(buf) + STRLEN(fname) >= len)
return FAIL;
@@ -2350,6 +2376,8 @@ mch_FullName(fname, buf, len, force)
if (STRCMP(fname, ".") != 0)
STRCAT(buf, fname);
#endif /* VMS */
return OK;
}

View File

@@ -106,7 +106,7 @@ struct efm_S
static int qf_init_ext __ARGS((qf_info_T *qi, char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast));
static void qf_new_list __ARGS((qf_info_T *qi));
static int qf_add_entry __ARGS((qf_info_T *qi, qfline_T **prevp, char_u *dir, char_u *fname, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid));
static int qf_add_entry __ARGS((qf_info_T *qi, qfline_T **prevp, char_u *dir, char_u *fname, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid));
static void qf_msg __ARGS((qf_info_T *qi));
static void qf_free __ARGS((qf_info_T *qi, int idx));
static char_u *qf_types __ARGS((int, int));
@@ -791,6 +791,7 @@ restofline:
(*namebuf || directory)
? namebuf
: ((currfile && valid) ? currfile : (char_u *)NULL),
0,
errmsg,
lnum,
col,
@@ -936,12 +937,13 @@ qf_free_all(wp)
* Returns OK or FAIL.
*/
static int
qf_add_entry(qi, prevp, dir, fname, mesg, lnum, col, vis_col, pattern, nr, type,
valid)
qf_add_entry(qi, prevp, dir, fname, bufnum, mesg, lnum, col, vis_col, pattern,
nr, type, valid)
qf_info_T *qi; /* quickfix list */
qfline_T **prevp; /* pointer to previously added entry or NULL */
char_u *dir; /* optional directory name */
char_u *fname; /* file name or NULL */
int bufnum; /* buffer number or zero */
char_u *mesg; /* message */
long lnum; /* line number */
int col; /* column */
@@ -955,7 +957,10 @@ qf_add_entry(qi, prevp, dir, fname, mesg, lnum, col, vis_col, pattern, nr, type,
if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL)
return FAIL;
qfp->qf_fnum = qf_get_fnum(dir, fname);
if (bufnum != 0)
qfp->qf_fnum = bufnum;
else
qfp->qf_fnum = qf_get_fnum(dir, fname);
if ((qfp->qf_text = vim_strsave(mesg)) == NULL)
{
vim_free(qfp);
@@ -1106,6 +1111,7 @@ copy_loclist(from, to)
if (qf_add_entry(to->w_llist, &prevp,
NULL,
NULL,
0,
from_qfp->qf_text,
from_qfp->qf_lnum,
from_qfp->qf_col,
@@ -3134,6 +3140,7 @@ ex_vimgrep(eap)
if (qf_add_entry(qi, &prevp,
NULL, /* dir */
fnames[fi],
0,
ml_get_buf(buf,
regmatch.startpos[0].lnum + lnum, FALSE),
regmatch.startpos[0].lnum + lnum,
@@ -3419,6 +3426,7 @@ get_errorlist(wp, list)
char_u buf[2];
qfline_T *qfp;
int i;
int bufnum;
if (wp != NULL)
{
@@ -3434,6 +3442,11 @@ get_errorlist(wp, list)
qfp = qi->qf_lists[qi->qf_curlist].qf_start;
for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ++i)
{
/* Handle entries with a non-existing buffer number. */
bufnum = qfp->qf_fnum;
if (bufnum != 0 && (buflist_findnr(bufnum) == NULL))
bufnum = 0;
if ((dict = dict_alloc()) == NULL)
return FAIL;
if (list_append_dict(list, dict) == FAIL)
@@ -3441,7 +3454,7 @@ get_errorlist(wp, list)
buf[0] = qfp->qf_type;
buf[1] = NUL;
if ( dict_add_nr_str(dict, "bufnr", (long)qfp->qf_fnum, NULL) == FAIL
if ( dict_add_nr_str(dict, "bufnr", (long)bufnum, NULL) == FAIL
|| dict_add_nr_str(dict, "lnum", (long)qfp->qf_lnum, NULL) == FAIL
|| dict_add_nr_str(dict, "col", (long)qfp->qf_col, NULL) == FAIL
|| dict_add_nr_str(dict, "vcol", (long)qfp->qf_viscol, NULL) == FAIL
@@ -3472,6 +3485,7 @@ set_errorlist(wp, list, action)
listitem_T *li;
dict_T *d;
char_u *filename, *pattern, *text, *type;
int bufnum;
long lnum;
int col, nr;
int vcol;
@@ -3479,6 +3493,7 @@ set_errorlist(wp, list, action)
int valid, status;
int retval = OK;
qf_info_T *qi = &ql_info;
int did_bufnr_emsg = FALSE;
if (wp != NULL)
{
@@ -3508,6 +3523,7 @@ set_errorlist(wp, list, action)
continue;
filename = get_dict_string(d, (char_u *)"filename", TRUE);
bufnum = get_dict_number(d, (char_u *)"bufnr");
lnum = get_dict_number(d, (char_u *)"lnum");
col = get_dict_number(d, (char_u *)"col");
vcol = get_dict_number(d, (char_u *)"vcol");
@@ -3519,12 +3535,26 @@ set_errorlist(wp, list, action)
text = vim_strsave((char_u *)"");
valid = TRUE;
if (filename == NULL || (lnum == 0 && pattern == NULL))
if ((filename == NULL && bufnum == 0) || (lnum == 0 && pattern == NULL))
valid = FALSE;
/* Mark entries with non-existing buffer number as not valid. Give the
* error message only once. */
if (bufnum != 0 && (buflist_findnr(bufnum) == NULL))
{
if (!did_bufnr_emsg)
{
did_bufnr_emsg = TRUE;
EMSGN(_("E92: Buffer %ld not found"), bufnum);
}
valid = FALSE;
bufnum = 0;
}
status = qf_add_entry(qi, &prevp,
NULL, /* dir */
filename,
bufnum,
text,
lnum,
col,
@@ -3757,6 +3787,7 @@ ex_helpgrep(eap)
if (qf_add_entry(qi, &prevp,
NULL, /* dir */
fnames[fi],
0,
IObuff,
lnum,
(int)(regmatch.startp[0] - IObuff)

View File

@@ -812,7 +812,11 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum)
#ifdef FEAT_MBYTE
if (has_mbyte)
{
ptr = ml_get_buf(buf, pos->lnum, FALSE);
/* 'e' offset may put us just below the last line */
if (pos->lnum > buf->b_ml.ml_line_count)
ptr = (char_u *)"";
else
ptr = ml_get_buf(buf, pos->lnum, FALSE);
pos->col -= (*mb_head_off)(ptr, ptr + pos->col);
}
#endif

View File

@@ -3206,7 +3206,7 @@ syn_cmd_spell(eap, syncing)
curbuf->b_syn_spell = SYNSPL_TOP;
else if (STRNICMP(arg, "notoplevel", 10) == 0 && next - arg == 10)
curbuf->b_syn_spell = SYNSPL_NOTOP;
else if (STRNICMP(arg, "default", 4) == 0 && next - arg == 4)
else if (STRNICMP(arg, "default", 7) == 0 && next - arg == 7)
curbuf->b_syn_spell = SYNSPL_DEFAULT;
else
EMSG2(_("E390: Illegal argument: %s"), arg);

View File

@@ -341,11 +341,15 @@ u_savecommon(top, bot, newbot)
uhp->uh_alt_next = old_curhead;
if (old_curhead != NULL)
{
uhp->uh_alt_prev = old_curhead->uh_alt_prev;
if (uhp->uh_alt_prev != NULL)
uhp->uh_alt_prev->uh_alt_next = uhp;
old_curhead->uh_alt_prev = uhp;
if (curbuf->b_u_oldhead == old_curhead)
curbuf->b_u_oldhead = uhp;
}
uhp->uh_alt_prev = NULL;
else
uhp->uh_alt_prev = NULL;
if (curbuf->b_u_newhead != NULL)
curbuf->b_u_newhead->uh_prev = uhp;
@@ -856,6 +860,11 @@ undo_time(step, sec, absolute)
uhp = curbuf->b_u_curhead;
while (uhp != NULL)
{
/* Go back to the first branch with a mark. */
while (uhp->uh_alt_prev != NULL
&& uhp->uh_alt_prev->uh_walk == mark)
uhp = uhp->uh_alt_prev;
/* Find the last branch with a mark, that's the one. */
last = uhp;
while (last->uh_alt_next != NULL
@@ -865,6 +874,8 @@ undo_time(step, sec, absolute)
{
/* Make the used branch the first entry in the list of
* alternatives to make "u" and CTRL-R take this branch. */
while (uhp->uh_alt_prev != NULL)
uhp = uhp->uh_alt_prev;
if (last->uh_alt_next != NULL)
last->uh_alt_next->uh_alt_prev = last->uh_alt_prev;
last->uh_alt_prev->uh_alt_next = last->uh_alt_next;

View File

@@ -666,6 +666,58 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
195,
/**/
194,
/**/
193,
/**/
192,
/**/
191,
/**/
190,
/**/
189,
/**/
188,
/**/
187,
/**/
186,
/**/
185,
/**/
184,
/**/
183,
/**/
182,
/**/
181,
/**/
180,
/**/
179,
/**/
178,
/**/
177,
/**/
176,
/**/
175,
/**/
174,
/**/
173,
/**/
172,
/**/
171,
/**/
170,
/**/
169,
/**/
@@ -1111,6 +1163,14 @@ list_version()
#endif
#ifdef VMS
MSG_PUTS("\nOpenVMS version");
# ifdef HAVE_PATHDEF
if (*compiled_arch != NUL)
{
MSG_PUTS(" - ");
MSG_PUTS(compiled_arch);
}
# endif
#endif
/* Print the list of patch numbers if there is at least one. */

View File

@@ -1102,7 +1102,7 @@ enum auto_event
EVENT_COLORSCHEME, /* after loading a colorscheme */
EVENT_FILEAPPENDPOST, /* after appending to a file */
EVENT_FILEAPPENDPRE, /* before appending to a file */
EVENT_FILEAPPENDCMD, /* appende to a file using command */
EVENT_FILEAPPENDCMD, /* append to a file using command */
EVENT_FILECHANGEDSHELL, /* after shell command that changed file */
EVENT_FILECHANGEDSHELLPOST, /* after (not) reloading changed file */
EVENT_FILECHANGEDRO, /* before first change to read-only file */
@@ -1147,6 +1147,7 @@ enum auto_event
EVENT_REMOTEREPLY, /* upon string reception from a remote vim */
EVENT_SWAPEXISTS, /* found existing swap file */
EVENT_SOURCEPRE, /* before sourcing a Vim script */
EVENT_SOURCECMD, /* sourcing a Vim script using command */
EVENT_SPELLFILEMISSING, /* spell file missing */
EVENT_CURSORMOVED, /* cursor was moved */
EVENT_CURSORMOVEDI, /* cursor was moved in Insert mode */