0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.0204

This commit is contained in:
Bram Moolenaar 2006-02-22 21:25:37 +00:00
parent 238a564935
commit d1f56e68f1
44 changed files with 612 additions and 183 deletions

View File

@ -334,6 +334,22 @@ CTRL-^ Edit the alternate file (equivalent to ":e #").
(For {Visual} see |Visual-mode|.) (For {Visual} see |Visual-mode|.)
{not in VI} {not in VI}
*gF*
[count]gF Same as "gf", except if a number follows the file
name, then the cursor is positioned on that line in
the file. The file name and the number must be
separated by a non-filename (see 'isfname') and
non-numeric character. White space between the
filename, the separator and the number are ignored.
Examples: >
eval.c:10
eval.c @ 20
eval.c (30)
eval.c 40
<
*v_gF*
{Visual}[count]gF Same as "v_gf".
These commands are used to start editing a single file. This means that the These commands are used to start editing a single file. This means that the
file is read into the buffer and the current file name is set. The file that file is read into the buffer and the current file name is set. The file that
is opened depends on the current directory, see |:cd|. is opened depends on the current directory, see |:cd|.

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.0aa. Last change: 2006 Feb 20 *eval.txt* For Vim version 7.0aa. Last change: 2006 Feb 22
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -6928,7 +6928,7 @@ This is not guaranteed 100% secure, but it should block most attacks.
*sandbox-option* *sandbox-option*
A few options contain an expression. When this expression is evaluated it may A few options contain an expression. When this expression is evaluated it may
have to be done in the sandbox to avoid trouble. But the sandbox is have to be done in the sandbox to avoid a security risc. But the sandbox is
restrictive, thus this only happens when the option was set from an insecure restrictive, thus this only happens when the option was set from an insecure
location. Insecure in this context are: location. Insecure in this context are:
- sourcing a .vimrc or .exrc in the current directlry - sourcing a .vimrc or .exrc in the current directlry

View File

@ -541,6 +541,9 @@ tag command action in Normal mode ~
the cursor the cursor
|CTRL-W_f| CTRL-W f split window and edit file name under the |CTRL-W_f| CTRL-W f split window and edit file name under the
cursor cursor
|CTRL-W_F| CTRL-W F split window and edit file name under the
cursor and jump to the line number
following the file name.
|CTRL-W_g_CTRL-]| CTRL-W g CTRL-] split window and do |:tjump| to tag under |CTRL-W_g_CTRL-]| CTRL-W g CTRL-] split window and do |:tjump| to tag under
cursor cursor
|CTRL-W_g]| CTRL-W g ] split window and do |:tselect| for tag |CTRL-W_g]| CTRL-W g ] split window and do |:tselect| for tag
@ -719,6 +722,9 @@ tag char note action in Normal mode ~
word word
|gf| gf start editing the file whose name is under |gf| gf start editing the file whose name is under
the cursor the cursor
|gF| gF start editing the file whose name is under
the cursor and jump to the line number
following the filename.
|gg| gg 1 cursor to line N, default first line |gg| gg 1 cursor to line N, default first line
|gh| gh start Select mode |gh| gh start Select mode
|gi| gi 2 like "i", but first move to the |'^| mark |gi| gi 2 like "i", but first move to the |'^| mark

View File

@ -1,4 +1,4 @@
*insert.txt* For Vim version 7.0aa. Last change: 2006 Feb 14 *insert.txt* For Vim version 7.0aa. Last change: 2006 Feb 22
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -993,10 +993,12 @@ items:
menu extra text for the popup menu menu extra text for the popup menu
info more information about the item info more information about the item
kind single letter indicating the type of completion kind single letter indicating the type of completion
icase when not zero case is to be ignored; when omitted
the 'ignorecase' option is used
All of these must be a string. If an item does not meet these requirements All of these except 'icase' must be a string. If an item does not meet these
then an error message is given and further items in the list are not used. requirements then an error message is given and further items in the list are
You can mix string and Dictionary items in the returned list. not used. You can mix string and Dictionary items in the returned list.
The "menu" item is used in the popup menu and may be truncated, thus it should The "menu" item is used in the popup menu and may be truncated, thus it should
be relatively short. The "info" item can be longer, it may be displayed in a be relatively short. The "info" item can be longer, it may be displayed in a

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 7.0aa. Last change: 2006 Feb 21 *options.txt* For Vim version 7.0aa. Last change: 2006 Feb 22
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -1629,7 +1629,9 @@ A jump table for the options with a short description can be found at |Q_op|.
sufficient colors are available. |ins-completion-menu| sufficient colors are available. |ins-completion-menu|
longest Only insert the longest common text of the matches. Use longest Only insert the longest common text of the matches. Use
CTRL-L to add more characters. CTRL-L to add more characters. Whether case is ignored
depends on the kind of completion. For buffer text the
'ignorecase' option is used.
*'confirm'* *'cf'* *'noconfirm'* *'nocf'* *'confirm'* *'cf'* *'noconfirm'* *'nocf'*
@ -2904,7 +2906,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|v:count| the number of lines to be formatted. |v:count| the number of lines to be formatted.
When this option is empty 'formatprg' is used. When this option is empty 'formatprg' is used.
Example: > Example: >
:set formatexp=mylang#Format() :set formatexpr=mylang#Format()
< This will invoke the mylang#Format() function in the < This will invoke the mylang#Format() function in the
autoload/mylang.vim file in 'runtimepath'. |autoload| autoload/mylang.vim file in 'runtimepath'. |autoload|
@ -6073,6 +6075,11 @@ A jump table for the options with a short description can be found at |Q_op|.
( - Start of item group. Can be used for setting the width and ( - Start of item group. Can be used for setting the width and
alignment of a section. Must be followed by %) somewhere. alignment of a section. Must be followed by %) somewhere.
) - End of item group. No width fields allowed. ) - End of item group. No width fields allowed.
T N For 'tabline': start of tab page N label. Use %T after the last
label. This information is used for mouse clicks.
X N For 'tabline': start of close tab N label. Use %X after the
label, e.g.: %3Xclose%X. Use %999X for a "close current tab"
mark. This information is used for mouse clicks.
< - Where to truncate line if too long. Default is at the start. < - Where to truncate line if too long. Default is at the start.
No width fields allowed. No width fields allowed.
= - Separation point between left and right aligned items. = - Separation point between left and right aligned items.
@ -6269,14 +6276,15 @@ A jump table for the options with a short description can be found at |Q_op|.
feature} feature}
When nonempty, this option determines the content of the tab pages When nonempty, this option determines the content of the tab pages
line at the top of the Vim window. When empty Vim will use a default line at the top of the Vim window. When empty Vim will use a default
tab pages line. |tab-page| tab pages line. See |setting-tabline| for more info.
The tab pages line only appears as specified with the 'showtabline' The tab pages line only appears as specified with the 'showtabline'
option and only when there is no GUI implementation for tabs. option and only when there is no GUI implementation for tabs.
The value is evaluated like with 'statusline'. You can use The value is evaluated like with 'statusline'. You can use
|tabpagenr()|, |tabpagewinnr()| and |tabpagebuflist()| to figure out |tabpagenr()|, |tabpagewinnr()| and |tabpagebuflist()| to figure out
the text to be displayed. See |setting-tabline| for more info. the text to be displayed. Use "%1T" for the first label, "%2T" for
the second one, etc. Use "%X" items for closing labels.
Keep in mind that only one of the tab pages is the current one, others Keep in mind that only one of the tab pages is the current one, others
are invisible and you can't jump to their windows. are invisible and you can't jump to their windows.

View File

@ -1,4 +1,4 @@
*tabpage.txt* For Vim version 7.0aa. Last change: 2006 Feb 21 *tabpage.txt* For Vim version 7.0aa. Last change: 2006 Feb 22
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -164,14 +164,28 @@ pages and define labels for them. Then get the label for each tab page. >
function MyTabLine() function MyTabLine()
let s = '' let s = ''
for i in range(tabpagenr('$')) for i in range(tabpagenr('$'))
" select the highlighting
if i + 1 == tabpagenr() if i + 1 == tabpagenr()
let s .= '%#TabLineSel#' let s .= '%#TabLineSel#'
else else
let s .= '%#TabLine#' let s .= '%#TabLine#'
endif endif
" set the tab page number (for mouse clicks)
let s .= '%' . (i + 1) . 'T'
" the label is made by MyTabLabel()
let s .= ' %{MyTabLabel(' . (i + 1) . ')} ' let s .= ' %{MyTabLabel(' . (i + 1) . ')} '
endfor endfor
let s .= '%#TabLineFill#'
" after the last tab fill with TabLineFill and reset tab page nr
let s .= '%#TabLineFill#%T'
" right-align the label to close the current tab page
if tabpagenr('$') > 1
let s .= '%=%#TabLine#%999Xclose'
endif
return s return s
endfunction endfunction
@ -187,7 +201,6 @@ This is just a simplistic example that results in a tab pages line that
resembles the default, but without adding a + for a modified buffer or resembles the default, but without adding a + for a modified buffer or
trunctating the names. You will want to reduce the width of labels in a trunctating the names. You will want to reduce the width of labels in a
clever way when there is not enough room. Check the 'columns' option for the clever way when there is not enough room. Check the 'columns' option for the
space available, keeping in mind that the "X" at the right will take one more space available.
position.
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:

View File

@ -3078,6 +3078,7 @@ CTRL-W_CTRL-Z windows.txt /*CTRL-W_CTRL-Z*
CTRL-W_CTRL-] windows.txt /*CTRL-W_CTRL-]* CTRL-W_CTRL-] windows.txt /*CTRL-W_CTRL-]*
CTRL-W_CTRL-^ windows.txt /*CTRL-W_CTRL-^* CTRL-W_CTRL-^ windows.txt /*CTRL-W_CTRL-^*
CTRL-W_CTRL-_ windows.txt /*CTRL-W_CTRL-_* CTRL-W_CTRL-_ windows.txt /*CTRL-W_CTRL-_*
CTRL-W_F windows.txt /*CTRL-W_F*
CTRL-W_H windows.txt /*CTRL-W_H* CTRL-W_H windows.txt /*CTRL-W_H*
CTRL-W_J windows.txt /*CTRL-W_J* CTRL-W_J windows.txt /*CTRL-W_J*
CTRL-W_K windows.txt /*CTRL-W_K* CTRL-W_K windows.txt /*CTRL-W_K*
@ -5285,6 +5286,7 @@ g?g? change.txt /*g?g?*
g@ map.txt /*g@* g@ map.txt /*g@*
gD pattern.txt /*gD* gD pattern.txt /*gD*
gE motion.txt /*gE* gE motion.txt /*gE*
gF editing.txt /*gF*
gH visual.txt /*gH* gH visual.txt /*gH*
gI insert.txt /*gI* gI insert.txt /*gI*
gJ change.txt /*gJ* gJ change.txt /*gJ*
@ -7283,6 +7285,7 @@ v_b_r_example visual.txt /*v_b_r_example*
v_c change.txt /*v_c* v_c change.txt /*v_c*
v_d change.txt /*v_d* v_d change.txt /*v_d*
v_g? change.txt /*v_g?* v_g? change.txt /*v_g?*
v_gF editing.txt /*v_gF*
v_gJ change.txt /*v_gJ* v_gJ change.txt /*v_gJ*
v_gV visual.txt /*v_gV* v_gV visual.txt /*v_gV*
v_g] tagsrch.txt /*v_g]* v_g] tagsrch.txt /*v_g]*

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.0aa. Last change: 2006 Feb 21 *todo.txt* For Vim version 7.0aa. Last change: 2006 Feb 22
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -30,18 +30,6 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs* *known-bugs*
-------------------- Known bugs and current work ----------------------- -------------------- Known bugs and current work -----------------------
Remove resetting "bold" from screen_start_highlight()?
Using 'tabline' breaks using mouse to select a tab. How to do that?
See suggestion from Tony Mechelynck.
P_INSECURE should be remembered for local option values separately.
Completion: <Up> and <Down> don't insert completion, <PageUp> and <PageDown>
shouldn't either.
Completion: case sensitiveness when typing BS: make it an option?
Completion: When back at the original word behave like after BS. Completion: When back at the original word behave like after BS.
Completion: When to get out of the BS state when the user keeps on typing? Completion: When to get out of the BS state when the user keeps on typing?
@ -89,11 +77,16 @@ windows. Let's call them "tab pages".
Crash with X command server (Ciaran McCreesh). Crash with X command server (Ciaran McCreesh).
Make virtcol([lnum, col]) work?
"dip" in end empty lines at end of file leaves one line. (Matt Mzyzik) "dip" in end empty lines at end of file leaves one line. (Matt Mzyzik)
Ctags still hasn't included the patch. Darren is looking for someone to do Ctags still hasn't included the patch. Darren is looking for someone to do
maintanance. maintanance.
Script ID is only remembered for global options. Should remember it for every
local option separately.
"fsutil hardlink" can create a hard link on an NTFS file system. (Daniel "fsutil hardlink" can create a hard link on an NTFS file system. (Daniel
Einspanjer) What library function can detect that? Einspanjer) What library function can detect that?

View File

@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 7.0aa. Last change: 2005 Nov 30 *usr_41.txt* For Vim version 7.0aa. Last change: 2006 Feb 22
VIM USER MANUAL - by Bram Moolenaar VIM USER MANUAL - by Bram Moolenaar
@ -834,7 +834,7 @@ For people who like short functions, this does the same thing: >
: return a:num2 : return a:num2
:endfunction :endfunction
A user defined function is called in exactly the same way as a builtin A user defined function is called in exactly the same way as a built-in
function. Only the name is different. The Min function can be used like function. Only the name is different. The Min function can be used like
this: > this: >
@ -2245,7 +2245,7 @@ organize your functions in library scripts. But you must use function names
where the part before the '#' matches the script name. Otherwise Vim would where the part before the '#' matches the script name. Otherwise Vim would
not know what script to load. not know what script to load.
If you get really enthousiastic and write lots of library scripts, you may If you get really enthusiastic and write lots of library scripts, you may
want to use subdirectories. Example: > want to use subdirectories. Example: >
call netlib#ftp#read('somefile') call netlib#ftp#read('somefile')

View File

@ -1,4 +1,4 @@
*version7.txt* For Vim version 7.0aa. Last change: 2006 Feb 21 *version7.txt* For Vim version 7.0aa. Last change: 2006 Feb 22
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -388,6 +388,14 @@ CTRL-W <Enter> In the quickfix window: opens a new window to show the
<A-RightMouse> ('mousemodel' "extend") <A-RightMouse> ('mousemodel' "extend")
Make a blockwise selection. |<A-LeftMouse>| Make a blockwise selection. |<A-LeftMouse>|
gF Start editing the filename under the cursor and jump
to the line number following the file name.
(Yegappan Lakshmanan)
CTRL-W F Start editing the filename under the cursor in a new
window and jump to the line number following the file
name. (Yegappan Lakshmanan)
Insert mode commands: ~ Insert mode commands: ~
CTRL-\ CTRL-O Execute a Normal mode command. Like CTRL-O but CTRL-\ CTRL-O Execute a Normal mode command. Like CTRL-O but
@ -800,9 +808,6 @@ upper case. Add color support to the builtin vt320 terminal codes.
For the '%' item in 'viminfo', allow a number to set a maximum for the number For the '%' item in 'viminfo', allow a number to set a maximum for the number
of buffers. of buffers.
The 'statusline' option can be local to the window, so that each window can
have a different value. (partly by Yegappan Lakshmanan)
When a file looks like a shell script, check for an "exec" command that starts When a file looks like a shell script, check for an "exec" command that starts
the tcl interpreter. (suggested by Alexios Zavras) the tcl interpreter. (suggested by Alexios Zavras)
@ -1018,12 +1023,20 @@ Insert mode completion for whole lines now also searches unloaded buffers.
The colortest.vim script can now be invoked directly with ":source" or The colortest.vim script can now be invoked directly with ":source" or
":runtime". ":runtime".
The 'statusline' option can be local to the window, so that each window can
have a different value. (partly by Yegappan Lakshmanan)
The 'statusline' option and other options that support the same format can now The 'statusline' option and other options that support the same format can now
use these new features: use these new features:
- When it starts with "%!" the value is first evaluated as an expression - When it starts with "%!" the value is first evaluated as an expression
before parsing the value. before parsing the value.
- "%#HLname#" can be used to start highlighting with HLname. - "%#HLname#" can be used to start highlighting with HLname.
When 'statusline' is set to something that causes an error message then it is
made empty to avoid an endless redraw loop. Also for other options, such at
'tabline'. ":verbose set statusline" will mention that it was set in an error
handler.
============================================================================== ==============================================================================
COMPILE TIME CHANGES *compile-changes-7* COMPILE TIME CHANGES *compile-changes-7*
@ -1722,4 +1735,8 @@ When editing in an xterm with a different number of colors than expected the
screen would be cleared and redrawn, causing the message about the edited file screen would be cleared and redrawn, causing the message about the edited file
to be cleared. Now set "keep_msg" to redraw the last message. to be cleared. Now set "keep_msg" to redraw the last message.
For a color terminal: When the Normal HL uses bold, possibly to make the color
lighter, and another HL group specifies a color it might become light as well.
Now reset bold if a HL group doesn't specify bold itself.
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:

View File

@ -714,6 +714,11 @@ CTRL-W CTRL-F Split current window in two. Edit file name under cursor.
{not available when the |+file_in_path| feature was disabled {not available when the |+file_in_path| feature was disabled
at compile time} at compile time}
CTRL-W F *CTRL-W_F*
Split current window in two. Edit file name under cursor and
jump to the line number following the file name. See |gF| for
details on how the line number is obtained.
Also see |CTRL-W_CTRL-I|: open window for an included file that includes Also see |CTRL-W_CTRL-I|: open window for an included file that includes
the keyword under the cursor. the keyword under the cursor.

View File

@ -3018,12 +3018,12 @@ maketitle()
int use_sandbox = FALSE; int use_sandbox = FALSE;
# ifdef FEAT_EVAL # ifdef FEAT_EVAL
use_sandbox = was_set_insecurely((char_u *)"titlestring"); use_sandbox = was_set_insecurely((char_u *)"titlestring", 0);
# endif # endif
if (stl_syntax & STL_IN_TITLE) if (stl_syntax & STL_IN_TITLE)
build_stl_str_hl(curwin, t_str, sizeof(buf), build_stl_str_hl(curwin, t_str, sizeof(buf),
p_titlestring, use_sandbox, p_titlestring, use_sandbox,
0, maxlen, NULL); 0, maxlen, NULL, NULL);
else else
#endif #endif
t_str = p_titlestring; t_str = p_titlestring;
@ -3115,12 +3115,12 @@ maketitle()
int use_sandbox = FALSE; int use_sandbox = FALSE;
# ifdef FEAT_EVAL # ifdef FEAT_EVAL
use_sandbox = was_set_insecurely((char_u *)"iconstring"); use_sandbox = was_set_insecurely((char_u *)"iconstring", 0);
# endif # endif
if (stl_syntax & STL_IN_ICON) if (stl_syntax & STL_IN_ICON)
build_stl_str_hl(curwin, i_str, sizeof(buf), build_stl_str_hl(curwin, i_str, sizeof(buf),
p_iconstring, use_sandbox, p_iconstring, use_sandbox,
0, 0, NULL); 0, 0, NULL, NULL);
else else
#endif #endif
i_str = p_iconstring; i_str = p_iconstring;
@ -3213,7 +3213,7 @@ free_titles()
* or truncated if too long, fillchar is used for all whitespace. * or truncated if too long, fillchar is used for all whitespace.
*/ */
int int
build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hl) build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, tabtab)
win_T *wp; win_T *wp;
char_u *out; /* buffer to write into */ char_u *out; /* buffer to write into */
size_t outlen; /* length of out[] */ size_t outlen; /* length of out[] */
@ -3221,7 +3221,8 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hl)
int use_sandbox; /* "fmt" was set insecurely, use sandbox */ int use_sandbox; /* "fmt" was set insecurely, use sandbox */
int fillchar; int fillchar;
int maxwidth; int maxwidth;
struct stl_hlrec *hl; struct stl_hlrec *hltab; /* return: HL attributes (can be NULL) */
struct stl_hlrec *tabtab; /* return: tab page nrs (can be NULL) */
{ {
char_u *p; char_u *p;
char_u *s; char_u *s;
@ -3258,6 +3259,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hl)
Group, Group,
Middle, Middle,
Highlight, Highlight,
TabPage,
Trunc Trunc
} type; } type;
} item[STL_MAX_ITEM]; } item[STL_MAX_ITEM];
@ -3269,6 +3271,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hl)
#define TMPLEN 70 #define TMPLEN 70
char_u tmp[TMPLEN]; char_u tmp[TMPLEN];
char_u *usefmt = fmt; char_u *usefmt = fmt;
struct stl_hlrec *sp;
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
/* /*
@ -3452,6 +3455,32 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hl)
curitem++; curitem++;
continue; continue;
} }
if (*s == STL_TABPAGENR || *s == STL_TABCLOSENR)
{
if (*s == STL_TABCLOSENR)
{
if (minwid == 0)
{
/* %X ends the close label, go back to the previously
* define tab label nr. */
for (n = curitem - 1; n >= 0; --n)
if (item[n].type == TabPage && item[n].minwid >= 0)
{
minwid = item[n].minwid;
break;
}
}
else
/* close nrs are stored as negative values */
minwid = - minwid;
}
item[curitem].type = TabPage;
item[curitem].start = p;
item[curitem].minwid = minwid;
s++;
curitem++;
continue;
}
if (*s == '.') if (*s == '.')
{ {
s++; s++;
@ -3953,19 +3982,38 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hl)
} }
} }
if (hl != NULL) /* Store the info about highlighting. */
if (hltab != NULL)
{ {
sp = hltab;
for (l = 0; l < itemcnt; l++) for (l = 0; l < itemcnt; l++)
{ {
if (item[l].type == Highlight) if (item[l].type == Highlight)
{ {
hl->start = item[l].start; sp->start = item[l].start;
hl->userhl = item[l].minwid; sp->userhl = item[l].minwid;
hl++; sp++;
} }
} }
hl->start = NULL; sp->start = NULL;
hl->userhl = 0; sp->userhl = 0;
}
/* Store the info about tab pages labels. */
if (tabtab != NULL)
{
sp = tabtab;
for (l = 0; l < itemcnt; l++)
{
if (item[l].type == TabPage)
{
sp->start = item[l].start;
sp->userhl = item[l].minwid;
sp++;
}
}
sp->start = NULL;
sp->userhl = 0;
} }
return width; return width;

View File

@ -1078,6 +1078,9 @@ diff_win_options(wp, addbuf)
curbuf = curwin->w_buffer; curbuf = curwin->w_buffer;
set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff", set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff",
OPT_LOCAL|OPT_FREE); OPT_LOCAL|OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"fdm", current_SID);
# endif
curwin = old_curwin; curwin = old_curwin;
curbuf = curwin->w_buffer; curbuf = curwin->w_buffer;
wp->w_p_fdc = 2; wp->w_p_fdc = 2;
@ -1125,6 +1128,9 @@ ex_diffoff(eap)
curbuf = curwin->w_buffer; curbuf = curwin->w_buffer;
set_string_option_direct((char_u *)"fdm", -1, set_string_option_direct((char_u *)"fdm", -1,
(char_u *)"manual", OPT_LOCAL|OPT_FREE); (char_u *)"manual", OPT_LOCAL|OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"fdm", current_SID);
# endif
curwin = old_curwin; curwin = old_curwin;
curbuf = curwin->w_buffer; curbuf = curwin->w_buffer;
wp->w_p_fdc = 0; wp->w_p_fdc = 0;

View File

@ -62,12 +62,13 @@ static char_u e_hitend[] = N_("Hit end of paragraph");
/* /*
* Structure used to store one match for insert completion. * Structure used to store one match for insert completion.
*/ */
typedef struct Completion compl_T; typedef struct compl_S compl_T;
struct Completion struct compl_S
{ {
compl_T *cp_next; compl_T *cp_next;
compl_T *cp_prev; compl_T *cp_prev;
char_u *cp_str; /* matched text */ char_u *cp_str; /* matched text */
char cp_icase; /* TRUE or FALSE: ignore case */
char_u *cp_extra; /* extra menu text (allocated, can be NULL) */ char_u *cp_extra; /* extra menu text (allocated, can be NULL) */
char_u *cp_info; /* verbose info (can be NULL) */ char_u *cp_info; /* verbose info (can be NULL) */
char_u cp_kind; /* kind of match, single letter, or NUL */ char_u cp_kind; /* kind of match, single letter, or NUL */
@ -121,8 +122,9 @@ static expand_T compl_xp;
static void ins_ctrl_x __ARGS((void)); static void ins_ctrl_x __ARGS((void));
static int has_compl_option __ARGS((int dict_opt)); static int has_compl_option __ARGS((int dict_opt));
static int ins_compl_equal __ARGS((compl_T *match, char_u *str, int len));
static void ins_compl_longest_match __ARGS((compl_T *match)); static void ins_compl_longest_match __ARGS((compl_T *match));
static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches)); static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int icase));
static int ins_compl_make_cyclic __ARGS((void)); static int ins_compl_make_cyclic __ARGS((void));
static void ins_compl_upd_pum __ARGS((void)); static void ins_compl_upd_pum __ARGS((void));
static void ins_compl_del_pum __ARGS((void)); static void ins_compl_del_pum __ARGS((void));
@ -144,6 +146,7 @@ static int ins_compl_next __ARGS((int allow_get_expansion, int count, int inser
static int ins_compl_key2dir __ARGS((int c)); static int ins_compl_key2dir __ARGS((int c));
static int ins_compl_pum_key __ARGS((int c)); static int ins_compl_pum_key __ARGS((int c));
static int ins_compl_key2count __ARGS((int c)); static int ins_compl_key2count __ARGS((int c));
static int ins_compl_use_match __ARGS((int c));
static int ins_complete __ARGS((int c)); static int ins_complete __ARGS((int c));
static int quote_meta __ARGS((char_u *dest, char_u *str, int len)); static int quote_meta __ARGS((char_u *dest, char_u *str, int len));
#endif /* FEAT_INS_EXPAND */ #endif /* FEAT_INS_EXPAND */
@ -1982,9 +1985,10 @@ vim_is_ctrl_x_key(c)
* TODO: make this work for multi-byte characters. * TODO: make this work for multi-byte characters.
*/ */
int int
ins_compl_add_infercase(str, len, fname, dir, flags) ins_compl_add_infercase(str, len, icase, fname, dir, flags)
char_u *str; char_u *str;
int len; int len;
int icase;
char_u *fname; char_u *fname;
int dir; int dir;
int flags; int flags;
@ -2038,26 +2042,22 @@ ins_compl_add_infercase(str, len, fname, dir, flags)
/* Copy the original case of the part we typed */ /* Copy the original case of the part we typed */
STRNCPY(IObuff, compl_orig_text, compl_length); STRNCPY(IObuff, compl_orig_text, compl_length);
return ins_compl_add(IObuff, len, fname, NULL, dir, flags); return ins_compl_add(IObuff, len, icase, fname, NULL, dir, flags);
} }
return ins_compl_add(str, len, fname, NULL, dir, flags); return ins_compl_add(str, len, icase, fname, NULL, dir, flags);
} }
/* /*
* Add a match to the list of matches. * Add a match to the list of matches.
* If the given string is already in the list of completions, then return * If the given string is already in the list of completions, then return
* FAIL, otherwise add it to the list and return OK. If there is an error,
* maybe because alloc() returns NULL, then RET_ERROR is returned -- webb.
*
* New:
* If the given string is already in the list of completions, then return
* NOTDONE, otherwise add it to the list and return OK. If there is an error, * NOTDONE, otherwise add it to the list and return OK. If there is an error,
* maybe because alloc() returns NULL, then FAIL is returned -- webb. * maybe because alloc() returns NULL, then FAIL is returned.
*/ */
int int
ins_compl_add(str, len, fname, extra, cdir, flags) ins_compl_add(str, len, icase, fname, extra, cdir, flags)
char_u *str; char_u *str;
int len; int len;
int icase;
char_u *fname; char_u *fname;
char_u *extra; /* extra text for popup menu or NULL */ char_u *extra; /* extra text for popup menu or NULL */
int cdir; int cdir;
@ -2081,7 +2081,7 @@ ins_compl_add(str, len, fname, extra, cdir, flags)
do do
{ {
if ( !(match->cp_flags & ORIGINAL_TEXT) if ( !(match->cp_flags & ORIGINAL_TEXT)
&& STRNCMP(match->cp_str, str, (size_t)len) == 0 && ins_compl_equal(match, str, len)
&& match->cp_str[len] == NUL) && match->cp_str[len] == NUL)
return NOTDONE; return NOTDONE;
match = match->cp_next; match = match->cp_next;
@ -2109,6 +2109,7 @@ ins_compl_add(str, len, fname, extra, cdir, flags)
vim_free(match); vim_free(match);
return FAIL; return FAIL;
} }
match->cp_icase = icase;
/* match-fname is: /* match-fname is:
* - compl_curr_match->cp_fname if it is a string equal to fname. * - compl_curr_match->cp_fname if it is a string equal to fname.
@ -2162,6 +2163,21 @@ ins_compl_add(str, len, fname, extra, cdir, flags)
return OK; return OK;
} }
/*
* Return TRUE if "str[len]" matches with match->cp_str, considering
* match->cp_icase.
*/
static int
ins_compl_equal(match, str, len)
compl_T *match;
char_u *str;
int len;
{
if (match->cp_icase)
return STRNICMP(match->cp_str, str, (size_t)len) == 0;
return STRNCMP(match->cp_str, str, (size_t)len) == 0;
}
/* /*
* Reduce the longest common string for match "match". * Reduce the longest common string for match "match".
*/ */
@ -2170,7 +2186,7 @@ ins_compl_longest_match(match)
compl_T *match; compl_T *match;
{ {
char_u *p, *s; char_u *p, *s;
int l; int c1, c2;
int had_match; int had_match;
if (compl_leader == NULL) if (compl_leader == NULL)
@ -2179,21 +2195,36 @@ ins_compl_longest_match(match)
else else
{ {
/* Reduce the text if this match differs from compl_leader. */ /* Reduce the text if this match differs from compl_leader. */
for (p = compl_leader, s = match->cp_str; *p != NUL; p += l, s += l) p = compl_leader;
s = match->cp_str;
while (*p != NUL)
{ {
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (has_mbyte) if (has_mbyte)
{ {
l = mb_ptr2len(p); c1 = mb_ptr2char(p);
if (STRNICMP(p, s, l) != 0) c2 = mb_ptr2char(s);
break;
} }
else else
#endif #endif
{ {
if (MB_TOLOWER(*p) != MB_TOLOWER(*s)) c1 = *p;
break; c2 = *s;
l = 1; }
if (match->cp_icase ? (MB_TOLOWER(c1) != MB_TOLOWER(c2))
: (c1 != c2))
break;
#ifdef FEAT_MBYTE
if (has_mbyte)
{
mb_ptr_adv(p);
mb_ptr_adv(s);
}
else
#endif
{
++p;
++s;
} }
} }
@ -2221,16 +2252,18 @@ ins_compl_longest_match(match)
* Frees matches[]. * Frees matches[].
*/ */
static void static void
ins_compl_add_matches(num_matches, matches) ins_compl_add_matches(num_matches, matches, icase)
int num_matches; int num_matches;
char_u **matches; char_u **matches;
int icase;
{ {
int i; int i;
int add_r = OK; int add_r = OK;
int dir = compl_direction; int dir = compl_direction;
for (i = 0; i < num_matches && add_r != FAIL; i++) for (i = 0; i < num_matches && add_r != FAIL; i++)
if ((add_r = ins_compl_add(matches[i], -1, NULL, NULL, dir, 0)) == OK) if ((add_r = ins_compl_add(matches[i], -1, icase,
NULL, NULL, dir, 0)) == OK)
/* if dir was BACKWARD then honor it just once */ /* if dir was BACKWARD then honor it just once */
dir = FORWARD; dir = FORWARD;
FreeWild(num_matches, matches); FreeWild(num_matches, matches);
@ -2376,7 +2409,7 @@ ins_compl_show_pum()
{ {
if ((compl->cp_flags & ORIGINAL_TEXT) == 0 if ((compl->cp_flags & ORIGINAL_TEXT) == 0
&& (compl_leader == NULL && (compl_leader == NULL
|| STRNCMP(compl->cp_str, compl_leader, lead_len) == 0)) || ins_compl_equal(compl, compl_leader, lead_len)))
++compl_match_arraysize; ++compl_match_arraysize;
compl = compl->cp_next; compl = compl->cp_next;
} while (compl != NULL && compl != compl_first_match); } while (compl != NULL && compl != compl_first_match);
@ -2393,8 +2426,7 @@ ins_compl_show_pum()
{ {
if ((compl->cp_flags & ORIGINAL_TEXT) == 0 if ((compl->cp_flags & ORIGINAL_TEXT) == 0
&& (compl_leader == NULL && (compl_leader == NULL
|| STRNCMP(compl->cp_str, compl_leader, || ins_compl_equal(compl, compl_leader, lead_len)))
lead_len) == 0))
{ {
if (!shown_match_ok) if (!shown_match_ok)
{ {
@ -2560,7 +2592,7 @@ ins_compl_dictionaries(dict, pat, flags, thesaurus)
ptr = find_word_end(ptr); ptr = find_word_end(ptr);
add_r = ins_compl_add_infercase(regmatch.startp[0], add_r = ins_compl_add_infercase(regmatch.startp[0],
(int)(ptr - regmatch.startp[0]), (int)(ptr - regmatch.startp[0]),
files[i], dir, 0); p_ic, files[i], dir, 0);
if (thesaurus) if (thesaurus)
{ {
char_u *wstart; char_u *wstart;
@ -2595,7 +2627,8 @@ ins_compl_dictionaries(dict, pat, flags, thesaurus)
#endif #endif
ptr = find_word_end(ptr); ptr = find_word_end(ptr);
add_r = ins_compl_add_infercase(wstart, add_r = ins_compl_add_infercase(wstart,
(int)(ptr - wstart), files[i], dir, 0); (int)(ptr - wstart),
p_ic, files[i], dir, 0);
} }
} }
if (add_r == OK) if (add_r == OK)
@ -3170,6 +3203,7 @@ expand_by_function(type, base)
pos_T pos; pos_T pos;
int dir = compl_direction; int dir = compl_direction;
char_u *x; char_u *x;
int icase;
funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu; funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu;
if (*funcname == NUL) if (*funcname == NUL)
@ -3192,6 +3226,12 @@ expand_by_function(type, base)
{ {
p = get_dict_string(li->li_tv.vval.v_dict, (char_u *)"word", FALSE); p = get_dict_string(li->li_tv.vval.v_dict, (char_u *)"word", FALSE);
x = get_dict_string(li->li_tv.vval.v_dict, (char_u *)"menu", FALSE); x = get_dict_string(li->li_tv.vval.v_dict, (char_u *)"menu", FALSE);
if (get_dict_string(li->li_tv.vval.v_dict, (char_u *)"icase",
FALSE) == NULL)
icase = p_ic;
else
icase = get_dict_number(li->li_tv.vval.v_dict,
(char_u *)"icase");
} }
else else
{ {
@ -3200,7 +3240,7 @@ expand_by_function(type, base)
} }
if (p != NULL && *p != NUL) if (p != NULL && *p != NUL)
{ {
if (ins_compl_add(p, -1, NULL, x, dir, 0) == OK) if (ins_compl_add(p, -1, icase, NULL, x, dir, 0) == OK)
/* if dir was BACKWARD then honor it just once */ /* if dir was BACKWARD then honor it just once */
dir = FORWARD; dir = FORWARD;
} }
@ -3399,7 +3439,7 @@ ins_compl_get_exp(ini)
TAG_INS_COMP | (ctrl_x_mode ? TAG_VERBOSE : 0), TAG_INS_COMP | (ctrl_x_mode ? TAG_VERBOSE : 0),
TAG_MANY, curbuf->b_ffname) == OK && num_matches > 0) TAG_MANY, curbuf->b_ffname) == OK && num_matches > 0)
{ {
ins_compl_add_matches(num_matches, matches); ins_compl_add_matches(num_matches, matches, p_ic);
} }
p_ic = save_p_ic; p_ic = save_p_ic;
break; break;
@ -3411,7 +3451,13 @@ ins_compl_get_exp(ini)
/* May change home directory back to "~". */ /* May change home directory back to "~". */
tilde_replace(compl_pattern, num_matches, matches); tilde_replace(compl_pattern, num_matches, matches);
ins_compl_add_matches(num_matches, matches); ins_compl_add_matches(num_matches, matches,
#ifdef CASE_INSENSITIVE_FILENAME
TRUE
#else
FALSE
#endif
);
} }
break; break;
@ -3419,7 +3465,7 @@ ins_compl_get_exp(ini)
if (expand_cmdline(&compl_xp, compl_pattern, if (expand_cmdline(&compl_xp, compl_pattern,
(int)STRLEN(compl_pattern), (int)STRLEN(compl_pattern),
&num_matches, &matches) == EXPAND_OK) &num_matches, &matches) == EXPAND_OK)
ins_compl_add_matches(num_matches, matches); ins_compl_add_matches(num_matches, matches, FALSE);
break; break;
#ifdef FEAT_COMPL_FUNC #ifdef FEAT_COMPL_FUNC
@ -3434,7 +3480,7 @@ ins_compl_get_exp(ini)
num_matches = expand_spelling(first_match_pos.lnum, num_matches = expand_spelling(first_match_pos.lnum,
first_match_pos.col, compl_pattern, &matches); first_match_pos.col, compl_pattern, &matches);
if (num_matches > 0) if (num_matches > 0)
ins_compl_add_matches(num_matches, matches); ins_compl_add_matches(num_matches, matches, FALSE);
#endif #endif
break; break;
@ -3568,7 +3614,7 @@ ins_compl_get_exp(ini)
continue; continue;
} }
} }
if (ins_compl_add_infercase(ptr, len, if (ins_compl_add_infercase(ptr, len, p_ic,
ins_buf == curbuf ? NULL : ins_buf->b_sfname, ins_buf == curbuf ? NULL : ins_buf->b_sfname,
0, flags) != NOTDONE) 0, flags) != NOTDONE)
{ {
@ -3687,8 +3733,8 @@ ins_compl_next(allow_get_expansion, count, insert_match)
{ {
/* Set "compl_shown_match" to the actually shown match, it may differ /* Set "compl_shown_match" to the actually shown match, it may differ
* when "compl_leader" is used to omit some of the matches. */ * when "compl_leader" is used to omit some of the matches. */
while (STRNCMP(compl_shown_match->cp_str, while (!ins_compl_equal(compl_shown_match,
compl_leader, STRLEN(compl_leader)) != 0 compl_leader, STRLEN(compl_leader))
&& compl_shown_match->cp_next != NULL && compl_shown_match->cp_next != NULL
&& compl_shown_match->cp_next != compl_first_match) && compl_shown_match->cp_next != compl_first_match)
compl_shown_match = compl_shown_match->cp_next; compl_shown_match = compl_shown_match->cp_next;
@ -3732,8 +3778,8 @@ ins_compl_next(allow_get_expansion, count, insert_match)
} }
if ((compl_shown_match->cp_flags & ORIGINAL_TEXT) == 0 if ((compl_shown_match->cp_flags & ORIGINAL_TEXT) == 0
&& compl_leader != NULL && compl_leader != NULL
&& STRNCMP(compl_shown_match->cp_str, && !ins_compl_equal(compl_shown_match,
compl_leader, STRLEN(compl_leader)) != 0) compl_leader, STRLEN(compl_leader)))
++todo; ++todo;
else else
/* Remember a matching item. */ /* Remember a matching item. */
@ -3890,6 +3936,29 @@ ins_compl_key2count(c)
return 1; return 1;
} }
/*
* Return TRUE if completion with "c" should insert the match, FALSE if only
* to change the currently selected completion.
*/
static int
ins_compl_use_match(c)
int c;
{
switch (c)
{
case K_UP:
case K_DOWN:
case K_PAGEDOWN:
case K_KPAGEDOWN:
case K_S_DOWN:
case K_PAGEUP:
case K_KPAGEUP:
case K_S_UP:
return FALSE;
}
return TRUE;
}
/* /*
* Do Insert mode completion. * Do Insert mode completion.
* Called when character "c" was typed, which has a meaning for completion. * Called when character "c" was typed, which has a meaning for completion.
@ -4252,7 +4321,7 @@ ins_complete(c)
* when the list of matches is freed. */ * when the list of matches is freed. */
compl_orig_text = vim_strnsave(line + compl_col, compl_length); compl_orig_text = vim_strnsave(line + compl_col, compl_length);
if (compl_orig_text == NULL || ins_compl_add(compl_orig_text, if (compl_orig_text == NULL || ins_compl_add(compl_orig_text,
-1, NULL, NULL, 0, ORIGINAL_TEXT) != OK) -1, FALSE, NULL, NULL, 0, ORIGINAL_TEXT) != OK)
{ {
vim_free(compl_pattern); vim_free(compl_pattern);
compl_pattern = NULL; compl_pattern = NULL;
@ -4278,7 +4347,7 @@ ins_complete(c)
/* /*
* Find next match (and following matches). * Find next match (and following matches).
*/ */
n = ins_compl_next(TRUE, ins_compl_key2count(c), c != K_UP && c != K_DOWN); n = ins_compl_next(TRUE, ins_compl_key2count(c), ins_compl_use_match(c));
/* may undisplay the popup menu */ /* may undisplay the popup menu */
ins_compl_upd_pum(); ins_compl_upd_pum();

View File

@ -1580,7 +1580,8 @@ eval_foldexpr(arg, cp)
typval_T tv; typval_T tv;
int retval; int retval;
char_u *s; char_u *s;
int use_sandbox = was_set_insecurely((char_u *)"foldexpr"); int use_sandbox = was_set_insecurely((char_u *)"foldexpr",
OPT_LOCAL);
++emsg_off; ++emsg_off;
if (use_sandbox) if (use_sandbox)
@ -8036,6 +8037,7 @@ f_complete_add(argvars, rettv)
{ {
char_u *word; char_u *word;
char_u *extra = NULL; char_u *extra = NULL;
int icase = FALSE;
if (argvars[0].v_type == VAR_DICT && argvars[0].vval.v_dict != NULL) if (argvars[0].v_type == VAR_DICT && argvars[0].vval.v_dict != NULL)
{ {
@ -8043,11 +8045,13 @@ f_complete_add(argvars, rettv)
(char_u *)"word", FALSE); (char_u *)"word", FALSE);
extra = get_dict_string(argvars[0].vval.v_dict, extra = get_dict_string(argvars[0].vval.v_dict,
(char_u *)"menu", FALSE); (char_u *)"menu", FALSE);
icase = get_dict_number(argvars[0].vval.v_dict, (char_u *)"icase");
} }
else else
word = get_tv_string_chk(&argvars[0]); word = get_tv_string_chk(&argvars[0]);
if (word != NULL) if (word != NULL)
rettv->vval.v_number = ins_compl_add(word, -1, NULL, extra, 0, 0); rettv->vval.v_number = ins_compl_add(word, -1, icase,
NULL, extra, 0, 0);
} }
/* /*

View File

@ -3266,6 +3266,9 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
#ifdef FEAT_QUICKFIX #ifdef FEAT_QUICKFIX
set_string_option_direct((char_u *)"buftype", -1, set_string_option_direct((char_u *)"buftype", -1,
(char_u *)"help", OPT_FREE|OPT_LOCAL); (char_u *)"help", OPT_FREE|OPT_LOCAL);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"buftype", current_SID);
# endif
#endif #endif
/* /*
@ -3285,6 +3288,9 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
{ {
set_string_option_direct((char_u *)"isk", -1, p, set_string_option_direct((char_u *)"isk", -1, p,
OPT_FREE|OPT_LOCAL); OPT_FREE|OPT_LOCAL);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"isk", current_SID);
# endif
check_buf_options(curbuf); check_buf_options(curbuf);
(void)buf_init_chartab(curbuf, FALSE); (void)buf_init_chartab(curbuf, FALSE);
} }

View File

@ -3077,13 +3077,15 @@ get_scriptname(id)
scid_T id; scid_T id;
{ {
if (id == SID_MODELINE) if (id == SID_MODELINE)
return (char_u *)"modeline"; return (char_u *)_("modeline");
if (id == SID_CMDARG) if (id == SID_CMDARG)
return (char_u *)"--cmd argument"; return (char_u *)_("--cmd argument");
if (id == SID_CARG) if (id == SID_CARG)
return (char_u *)"-c argument"; return (char_u *)_("-c argument");
if (id == SID_ENV) if (id == SID_ENV)
return (char_u *)"environment variable"; return (char_u *)_("environment variable");
if (id == SID_ERROR)
return (char_u *)_("error handler");
return SCRIPT_ITEM(id).sn_name; return SCRIPT_ITEM(id).sn_name;
} }

View File

@ -9225,7 +9225,7 @@ eval_vars(src, usedlen, lnump, errormsg, srcstart)
#ifdef FEAT_SEARCHPATH #ifdef FEAT_SEARCHPATH
case SPEC_CFILE: /* file name under cursor */ case SPEC_CFILE: /* file name under cursor */
result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L); result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL);
if (result == NULL) if (result == NULL)
{ {
*errormsg = (char_u *)""; *errormsg = (char_u *)"";

View File

@ -583,8 +583,13 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
/* set forced 'fileencoding' */ /* set forced 'fileencoding' */
fenc = enc_canonize(eap->cmd + eap->force_enc); fenc = enc_canonize(eap->cmd + eap->force_enc);
if (fenc != NULL) if (fenc != NULL)
{
set_string_option_direct((char_u *)"fenc", -1, set_string_option_direct((char_u *)"fenc", -1,
fenc, OPT_FREE|OPT_LOCAL); fenc, OPT_FREE|OPT_LOCAL);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"fenc", current_SID);
# endif
}
vim_free(fenc); vim_free(fenc);
} }
#endif #endif
@ -2108,8 +2113,13 @@ failed:
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
/* If editing a new file: set 'fenc' for the current buffer. */ /* If editing a new file: set 'fenc' for the current buffer. */
if (newfile) if (newfile)
{
set_string_option_direct((char_u *)"fenc", -1, fenc, set_string_option_direct((char_u *)"fenc", -1, fenc,
OPT_FREE|OPT_LOCAL); OPT_FREE|OPT_LOCAL);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"fenc", current_SID);
# endif
}
if (fenc_alloced) if (fenc_alloced)
vim_free(fenc); vim_free(fenc);
# ifdef USE_ICONV # ifdef USE_ICONV

View File

@ -1939,7 +1939,7 @@ get_foldtext(wp, lnum, lnume, foldinfo, buf)
++emsg_off; ++emsg_off;
text = eval_to_string_safe(wp->w_p_fdt, NULL, text = eval_to_string_safe(wp->w_p_fdt, NULL,
was_set_insecurely((char_u *)"foldtext")); was_set_insecurely((char_u *)"foldtext", OPT_LOCAL));
--emsg_off; --emsg_off;
curwin = save_curwin; curwin = save_curwin;

View File

@ -62,7 +62,14 @@ EXTERN schar_T *ScreenLines2 INIT(= NULL);
#endif #endif
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
EXTERN char_u *TabPageIdxs INIT(= NULL); /* indexes for tab page line */ /*
* Indexes for tab page line:
* N > 0 for label of tab page N
* N == 0 for no label
* N < 0 for closing tab page -N
* N == -999 for closing current tab page
*/
EXTERN short *TabPageIdxs INIT(= NULL);
#endif #endif
EXTERN int screen_Rows INIT(= 0); /* actual size of ScreenLines[] */ EXTERN int screen_Rows INIT(= 0); /* actual size of ScreenLines[] */

View File

@ -786,6 +786,9 @@ set_guifontwide(name)
gui.wide_font = font; gui.wide_font = font;
set_string_option_direct((char_u *)"gfw", -1, set_string_option_direct((char_u *)"gfw", -1,
wide_name, OPT_FREE); wide_name, OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"gfw", current_SID);
# endif
} }
} }
break; break;

View File

@ -55,7 +55,7 @@ general_beval_cb(beval, state)
set_vim_var_string(VV_BEVAL_TEXT, text, -1); set_vim_var_string(VV_BEVAL_TEXT, text, -1);
vim_free(text); vim_free(text);
use_sandbox = was_set_insecurely((char_u *)"balloonexpr"); use_sandbox = was_set_insecurely((char_u *)"balloonexpr", 0);
if (use_sandbox) if (use_sandbox)
++sandbox; ++sandbox;
++textlock; ++textlock;

View File

@ -492,11 +492,11 @@ prt_header(psettings, pagenum, lnum)
printer_page_num = pagenum; printer_page_num = pagenum;
# ifdef FEAT_EVAL # ifdef FEAT_EVAL
use_sandbox = was_set_insecurely((char_u *)"printheader"); use_sandbox = was_set_insecurely((char_u *)"printheader", 0);
# endif # endif
build_stl_str_hl(curwin, tbuf, (size_t)(width + IOSIZE), build_stl_str_hl(curwin, tbuf, (size_t)(width + IOSIZE),
p_header, use_sandbox, p_header, use_sandbox,
' ', width, NULL); ' ', width, NULL, NULL);
/* Reset line numbers */ /* Reset line numbers */
curwin->w_cursor.lnum = tmp_lnum; curwin->w_cursor.lnum = tmp_lnum;

View File

@ -635,8 +635,13 @@ main
if (params.edit_type == EDIT_QF) if (params.edit_type == EDIT_QF)
{ {
if (params.use_ef != NULL) if (params.use_ef != NULL)
{
set_string_option_direct((char_u *)"ef", -1, set_string_option_direct((char_u *)"ef", -1,
params.use_ef, OPT_FREE); params.use_ef, OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"ef", SID_CARG);
# endif
}
if (qf_init(NULL, p_ef, p_efm, TRUE) < 0) if (qf_init(NULL, p_ef, p_efm, TRUE) < 0)
{ {
out_char('\n'); out_char('\n');

View File

@ -731,8 +731,13 @@ codepage_invalid:
/* When using Unicode, set default for 'fileencodings'. */ /* When using Unicode, set default for 'fileencodings'. */
if (enc_utf8 && !option_was_set((char_u *)"fencs")) if (enc_utf8 && !option_was_set((char_u *)"fencs"))
{
set_string_option_direct((char_u *)"fencs", -1, set_string_option_direct((char_u *)"fencs", -1,
(char_u *)"ucs-bom,utf-8,default,latin1", OPT_FREE); (char_u *)"ucs-bom,utf-8,default,latin1", OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"fencs", current_SID);
# endif
}
#if defined(HAVE_BIND_TEXTDOMAIN_CODESET) && defined(FEAT_GETTEXT) #if defined(HAVE_BIND_TEXTDOMAIN_CODESET) && defined(FEAT_GETTEXT)
/* GNU gettext 0.10.37 supports this feature: set the codeset used for /* GNU gettext 0.10.37 supports this feature: set the codeset used for
* translated messages independently from the current locale. */ * translated messages independently from the current locale. */

View File

@ -7677,7 +7677,8 @@ get_expr_indent()
int indent; int indent;
pos_T pos; pos_T pos;
int save_State; int save_State;
int use_sandbox = was_set_insecurely((char_u *)"indentexpr"); int use_sandbox = was_set_insecurely((char_u *)"indentexpr",
OPT_LOCAL);
pos = curwin->w_cursor; pos = curwin->w_cursor;
set_vim_var_nr(VV_LNUM, curwin->w_cursor.lnum); set_vim_var_nr(VV_LNUM, curwin->w_cursor.lnum);

View File

@ -2793,8 +2793,13 @@ set_fileformat(t, opt_flags)
break; break;
} }
if (p != NULL) if (p != NULL)
{
set_string_option_direct((char_u *)"ff", -1, (char_u *)p, set_string_option_direct((char_u *)"ff", -1, (char_u *)p,
OPT_FREE | opt_flags); OPT_FREE | opt_flags);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"ff", current_SID);
# endif
}
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
/* This may cause the buffer to become (un)modified. */ /* This may cause the buffer to become (un)modified. */
check_status(curbuf); check_status(curbuf);

View File

@ -2427,28 +2427,43 @@ do_mouse(oap, c, dir, count, fixindent)
{ {
got_click = FALSE; /* ignore mouse-up and drag events */ got_click = FALSE; /* ignore mouse-up and drag events */
/* click in last column closes the current tab page. */
if (mouse_col == Columns - 1 && first_tabpage->tp_next != NULL)
{
tabpage_close(FALSE);
return TRUE;
}
/* click in a tab selects that tab page */ /* click in a tab selects that tab page */
if (is_click if (is_click
# ifdef FEAT_CMDWIN # ifdef FEAT_CMDWIN
&& cmdwin_type == 0 && cmdwin_type == 0
# endif # endif
&& mouse_col < Columns && TabPageIdxs[mouse_col] != 0xff) && mouse_col < Columns)
{ {
goto_tabpage(TabPageIdxs[mouse_col]); c1 = TabPageIdxs[mouse_col];
if (c1 >= 0)
{
/* Go to specified tab page, or next one if not clicking on a
* label. */
goto_tabpage(c1);
/* It's like clicking on the status line of a window. */ /* It's like clicking on the status line of a window. */
if (curwin != old_curwin) if (curwin != old_curwin)
end_visual_mode(); end_visual_mode();
return TRUE; }
else if (c1 < 0)
{
tabpage_T *tp;
/* Close the current or specified tab page. */
if (c1 == -999)
tp = curtab;
else
tp = find_tabpage(-c1);
if (tp == curtab)
{
if (first_tabpage->tp_next != NULL)
tabpage_close(FALSE);
}
else if (tp != NULL)
tabpage_close_other(tp, FALSE);
}
} }
return FALSE; return TRUE;
} }
#endif #endif
@ -5785,6 +5800,7 @@ nv_gotofile(cap)
cmdarg_T *cap; cmdarg_T *cap;
{ {
char_u *ptr; char_u *ptr;
linenr_T lnum = -1;
if (text_locked()) if (text_locked())
{ {
@ -5793,7 +5809,7 @@ nv_gotofile(cap)
return; return;
} }
ptr = grab_file_name(cap->count1); ptr = grab_file_name(cap->count1, &lnum);
if (ptr != NULL) if (ptr != NULL)
{ {
@ -5803,6 +5819,12 @@ nv_gotofile(cap)
setpcmark(); setpcmark();
(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LAST, (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,
P_HID(curbuf) ? ECMD_HIDE : 0); P_HID(curbuf) ? ECMD_HIDE : 0);
if (cap->nchar == 'F' && lnum >= 0)
{
curwin->w_cursor.lnum = lnum;
check_cursor_lnum();
beginline(BL_SOL | BL_FIX);
}
vim_free(ptr); vim_free(ptr);
} }
else else
@ -7720,6 +7742,7 @@ nv_g_cmd(cap)
* "]f" and "[f": can also be used. * "]f" and "[f": can also be used.
*/ */
case 'f': case 'f':
case 'F':
nv_gotofile(cap); nv_gotofile(cap);
break; break;
#endif #endif

View File

@ -1439,7 +1439,7 @@ get_spec_reg(regname, argp, allocated, errmsg)
if (!errmsg) if (!errmsg)
return FALSE; return FALSE;
*argp = file_name_at_cursor(FNAME_MESS | FNAME_HYP *argp = file_name_at_cursor(FNAME_MESS | FNAME_HYP
| (regname == Ctrl_P ? FNAME_EXP : 0), 1L); | (regname == Ctrl_P ? FNAME_EXP : 0), 1L, NULL);
*allocated = TRUE; *allocated = TRUE;
return TRUE; return TRUE;
#endif #endif
@ -4334,7 +4334,8 @@ fex_format(lnum, count)
linenr_T lnum; linenr_T lnum;
long count; long count;
{ {
int use_sandbox = was_set_insecurely((char_u *)"formatexpr"); int use_sandbox = was_set_insecurely((char_u *)"formatexpr",
OPT_LOCAL);
int r; int r;
/* /*

View File

@ -2673,6 +2673,11 @@ static void did_set_title __ARGS((int icon));
static char_u *option_expand __ARGS((int opt_idx, char_u *val)); static char_u *option_expand __ARGS((int opt_idx, char_u *val));
static void didset_options __ARGS((void)); static void didset_options __ARGS((void));
static void check_string_option __ARGS((char_u **pp)); static void check_string_option __ARGS((char_u **pp));
#if defined(FEAT_EVAL) || defined(PROTO)
static long_u *insecure_flag __ARGS((int opt_idx, int opt_flags));
#else
# define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags)
#endif
static void set_string_option_global __ARGS((int opt_idx, char_u **varp)); static void set_string_option_global __ARGS((int opt_idx, char_u **varp));
static void set_string_option __ARGS((int opt_idx, char_u *value, int opt_flags)); static void set_string_option __ARGS((int opt_idx, char_u *value, int opt_flags));
static char_u *did_set_string_option __ARGS((int opt_idx, char_u **varp, int new_value_alloced, char_u *oldval, char_u *errbuf, int opt_flags)); static char_u *did_set_string_option __ARGS((int opt_idx, char_u **varp, int new_value_alloced, char_u *oldval, char_u *errbuf, int opt_flags));
@ -3143,6 +3148,7 @@ set_option_default(opt_idx, opt_flags, compatible)
char_u *varp; /* pointer to variable for current option */ char_u *varp; /* pointer to variable for current option */
int dvi; /* index in def_val[] */ int dvi; /* index in def_val[] */
long_u flags; long_u flags;
long_u *flagsp;
int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags); varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags);
@ -3188,10 +3194,9 @@ set_option_default(opt_idx, opt_flags, compatible)
*(int *)varp; *(int *)varp;
} }
/* The default value is not insecure. But if there are local values /* The default value is not insecure. */
* we can't be sure. */ flagsp = insecure_flag(opt_idx, opt_flags);
if (options[opt_idx].indir == PV_NONE) *flagsp = *flagsp & ~P_INSECURE;
options[opt_idx].flags &= ~P_INSECURE;
} }
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
@ -4467,19 +4472,22 @@ did_set_option(opt_idx, opt_flags, new_value)
int opt_flags; /* possibly with OPT_MODELINE */ int opt_flags; /* possibly with OPT_MODELINE */
int new_value; /* value was replaced completely */ int new_value; /* value was replaced completely */
{ {
long_u *p;
options[opt_idx].flags |= P_WAS_SET; options[opt_idx].flags |= P_WAS_SET;
/* When an option is set in the sandbox, from a modeline or in secure mode /* When an option is set in the sandbox, from a modeline or in secure mode
* set the P_INSECURE flag. Otherwise, if a new value is stored reset the * set the P_INSECURE flag. Otherwise, if a new value is stored reset the
* flag. But not when there are local values. */ * flag. */
p = insecure_flag(opt_idx, opt_flags);
if (secure if (secure
#ifdef HAVE_SANDBOX #ifdef HAVE_SANDBOX
|| sandbox != 0 || sandbox != 0
#endif #endif
|| (opt_flags & OPT_MODELINE)) || (opt_flags & OPT_MODELINE))
options[opt_idx].flags |= P_INSECURE; *p = *p | P_INSECURE;
else if (new_value && options[opt_idx].indir == PV_NONE) else if (new_value)
options[opt_idx].flags &= ~P_INSECURE; *p = *p & ~P_INSECURE;
} }
static char_u * static char_u *
@ -4924,16 +4932,55 @@ set_term_option_alloced(p)
* Return -1 for an unknown option. * Return -1 for an unknown option.
*/ */
int int
was_set_insecurely(opt) was_set_insecurely(opt, opt_flags)
char_u *opt; char_u *opt;
int opt_flags;
{ {
int idx = findoption(opt); int idx = findoption(opt);
long_u *flagp;
if (idx >= 0) if (idx >= 0)
return (options[idx].flags & P_INSECURE) != 0; {
flagp = insecure_flag(idx, opt_flags);
return (*flagp & P_INSECURE) != 0;
}
EMSG2(_(e_intern2), "was_set_insecurely()"); EMSG2(_(e_intern2), "was_set_insecurely()");
return -1; return -1;
} }
/*
* Get a pointer to the flags used for the P_INSECURE flag of option
* "opt_idx". For some local options a local flags field is used.
*/
static long_u *
insecure_flag(opt_idx, opt_flags)
int opt_idx;
int opt_flags;
{
if (opt_flags & OPT_LOCAL)
switch ((int)options[opt_idx].indir)
{
#ifdef FEAT_STL_OPT
case OPT_BOTH(PV_STL): return &curwin->w_p_stl_flags;
#endif
#ifdef FEAT_EVAL
case PV_FDE: return &curwin->w_p_fde_flags;
case PV_FDT: return &curwin->w_p_fdt_flags;
#endif
#if defined(FEAT_EVAL)
# if defined(FEAT_CINDENT)
case PV_INDE: return &curbuf->b_p_inde_flags;
# endif
case PV_FEX: return &curbuf->b_p_fex_flags;
# ifdef FEAT_FIND_ID
case PV_INEX: return &curbuf->b_p_inex_flags;
# endif
#endif
}
/* Nothing special, return global flags field. */
return &options[opt_idx].flags;
}
#endif #endif
/* /*
@ -6657,6 +6704,24 @@ compile_cap_prog(buf)
} }
#endif #endif
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Set the script ID of option "name" to "id".
*/
void
set_option_scriptID(name, id)
char_u *name;
int id;
{
int opt_idx = findoption(name);
if (opt_idx == -1) /* not found (should not happen) */
EMSG2(_(e_intern2), "set_option_scriptID()");
else
options[opt_idx].scriptID = id;
}
#endif
/* /*
* Set the value of a boolean option, and take care of side effects. * Set the value of a boolean option, and take care of side effects.
* Returns NULL for success, or an error message for an error. * Returns NULL for success, or an error message for an error.
@ -6766,6 +6831,9 @@ set_bool_option(opt_idx, varp, value, opt_flags)
STRCPY(IObuff, p_shm); STRCPY(IObuff, p_shm);
STRCAT(IObuff, "s"); STRCAT(IObuff, "s");
set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE); set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"shm", current_SID);
# endif
} }
/* remove 's' from p_shm */ /* remove 's' from p_shm */
else if (!p_terse && p != NULL) else if (!p_terse && p != NULL)
@ -6851,6 +6919,9 @@ set_bool_option(opt_idx, varp, value, opt_flags)
set_string_option_direct((char_u *)"ffs", -1, set_string_option_direct((char_u *)"ffs", -1,
p_ta ? (char_u *)DFLT_FFS_VIM : (char_u *)"", p_ta ? (char_u *)DFLT_FFS_VIM : (char_u *)"",
OPT_FREE | opt_flags); OPT_FREE | opt_flags);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"ffs", current_SID);
# endif
} }
/* /*

View File

@ -288,6 +288,8 @@
#define STL_TRUNCMARK '<' /* truncation mark if line is too long*/ #define STL_TRUNCMARK '<' /* truncation mark if line is too long*/
#define STL_USER_HL '*' /* highlight from (User)1..9 or 0 */ #define STL_USER_HL '*' /* highlight from (User)1..9 or 0 */
#define STL_HIGHLIGHT '#' /* highlight name */ #define STL_HIGHLIGHT '#' /* highlight name */
#define STL_TABPAGENR 'T' /* tab page label nr */
#define STL_TABCLOSENR 'X' /* tab page close nr */
#define STL_ALL ((char_u *) "fFtcvVlLknoObBrRhHmYyWwMpPaN{#") #define STL_ALL ((char_u *) "fFtcvVlLknoObBrRhHmYyWwMpPaN{#")
/* flags used for parsed 'wildmode' */ /* flags used for parsed 'wildmode' */

View File

@ -40,7 +40,7 @@ void col_print __ARGS((char_u *buf, int col, int vcol));
void maketitle __ARGS((void)); void maketitle __ARGS((void));
void resettitle __ARGS((void)); void resettitle __ARGS((void));
void free_titles __ARGS((void)); void free_titles __ARGS((void));
int build_stl_str_hl __ARGS((win_T *wp, char_u *out, size_t outlen, char_u *fmt, int insecure, int fillchar, int maxwidth, struct stl_hlrec *hl)); int build_stl_str_hl __ARGS((win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use_sandbox, int fillchar, int maxwidth, struct stl_hlrec *hltab, struct stl_hlrec *tabtab));
void get_rel_pos __ARGS((win_T *wp, char_u *str)); void get_rel_pos __ARGS((win_T *wp, char_u *str));
int append_arg_number __ARGS((win_T *wp, char_u *buf, int add_file, int maxlen)); int append_arg_number __ARGS((win_T *wp, char_u *buf, int add_file, int maxlen));
char_u *fix_fname __ARGS((char_u *fname)); char_u *fix_fname __ARGS((char_u *fname));

View File

@ -7,8 +7,8 @@ void change_indent __ARGS((int type, int amount, int round, int replaced));
void truncate_spaces __ARGS((char_u *line)); void truncate_spaces __ARGS((char_u *line));
void backspace_until_column __ARGS((int col)); void backspace_until_column __ARGS((int col));
int vim_is_ctrl_x_key __ARGS((int c)); int vim_is_ctrl_x_key __ARGS((int c));
int ins_compl_add_infercase __ARGS((char_u *str, int len, char_u *fname, int dir, int flags)); int ins_compl_add_infercase __ARGS((char_u *str, int len, int icase, char_u *fname, int dir, int flags));
int ins_compl_add __ARGS((char_u *str, int len, char_u *fname, char_u *extra, int cdir, int flags)); int ins_compl_add __ARGS((char_u *str, int len, int icase, char_u *fname, char_u *extra, int cdir, int flags));
void ins_compl_show_pum __ARGS((void)); void ins_compl_show_pum __ARGS((void));
char_u *find_word_start __ARGS((char_u *ptr)); char_u *find_word_start __ARGS((char_u *ptr));
char_u *find_word_end __ARGS((char_u *ptr)); char_u *find_word_end __ARGS((char_u *ptr));

View File

@ -17,9 +17,10 @@ void check_buf_options __ARGS((buf_T *buf));
void free_string_option __ARGS((char_u *p)); void free_string_option __ARGS((char_u *p));
void clear_string_option __ARGS((char_u **pp)); void clear_string_option __ARGS((char_u **pp));
void set_term_option_alloced __ARGS((char_u **p)); void set_term_option_alloced __ARGS((char_u **p));
int was_set_insecurely __ARGS((char_u *opt)); int was_set_insecurely __ARGS((char_u *opt, int opt_flags));
void set_string_option_direct __ARGS((char_u *name, int opt_idx, char_u *val, int opt_flags)); void set_string_option_direct __ARGS((char_u *name, int opt_idx, char_u *val, int opt_flags));
char_u *check_stl_option __ARGS((char_u *s)); char_u *check_stl_option __ARGS((char_u *s));
void set_option_scriptID __ARGS((char_u *name, int id));
int get_option_value __ARGS((char_u *name, long *numval, char_u **stringval, int opt_flags)); int get_option_value __ARGS((char_u *name, long *numval, char_u **stringval, int opt_flags));
void set_option_value __ARGS((char_u *name, long number, char_u *string, int opt_flags)); void set_option_value __ARGS((char_u *name, long number, char_u *string, int opt_flags));
char_u *get_term_code __ARGS((char_u *tname)); char_u *get_term_code __ARGS((char_u *tname));

View File

@ -41,9 +41,9 @@ void win_comp_scroll __ARGS((win_T *wp));
void command_height __ARGS((long old_p_ch)); void command_height __ARGS((long old_p_ch));
void last_status __ARGS((int morewin)); void last_status __ARGS((int morewin));
int tabpageline_height __ARGS((void)); int tabpageline_height __ARGS((void));
char_u *grab_file_name __ARGS((long count)); char_u *grab_file_name __ARGS((long count, linenr_T *file_lnum));
char_u *file_name_at_cursor __ARGS((int options, long count)); char_u *file_name_at_cursor __ARGS((int options, long count, linenr_T *file_lnum));
char_u *file_name_in_line __ARGS((char_u *line, int col, int options, long count, char_u *rel_fname)); char_u *file_name_in_line __ARGS((char_u *line, int col, int options, long count, char_u *rel_fname, linenr_T *file_lnum));
char_u *find_file_name_in_path __ARGS((char_u *ptr, int len, int options, long count, char_u *rel_fname)); char_u *find_file_name_in_path __ARGS((char_u *ptr, int len, int options, long count, char_u *rel_fname));
int path_with_url __ARGS((char_u *fname)); int path_with_url __ARGS((char_u *fname));
int vim_isAbsName __ARGS((char_u *name)); int vim_isAbsName __ARGS((char_u *name));

View File

@ -2839,7 +2839,12 @@ ex_cfile(eap)
wp = curwin; wp = curwin;
if (*eap->arg != NUL) if (*eap->arg != NUL)
{
set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE); set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"ef", current_SID);
# endif
}
/* /*
* This function is used by the :cfile, :cgetfile and :caddfile * This function is used by the :cfile, :cgetfile and :caddfile

View File

@ -5474,9 +5474,14 @@ redraw_custum_statusline(wp)
called_emsg = FALSE; called_emsg = FALSE;
win_redr_custom(wp, FALSE); win_redr_custom(wp, FALSE);
if (called_emsg) if (called_emsg)
{
set_string_option_direct((char_u *)"statusline", -1, set_string_option_direct((char_u *)"statusline", -1,
(char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
? OPT_LOCAL : OPT_GLOBAL)); ? OPT_LOCAL : OPT_GLOBAL));
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"statusline", SID_ERROR);
# endif
}
called_emsg |= save_called_emsg; called_emsg |= save_called_emsg;
} }
#endif #endif
@ -5586,7 +5591,8 @@ win_redr_custom(wp, draw_ruler)
int fillchar; int fillchar;
char_u buf[MAXPATHL]; char_u buf[MAXPATHL];
char_u *p; char_u *p;
struct stl_hlrec hl[STL_MAX_ITEM]; struct stl_hlrec hltab[STL_MAX_ITEM];
struct stl_hlrec tabtab[STL_MAX_ITEM];
int use_sandbox = FALSE; int use_sandbox = FALSE;
/* setup environment for the task at hand */ /* setup environment for the task at hand */
@ -5599,7 +5605,7 @@ win_redr_custom(wp, draw_ruler)
attr = hl_attr(HLF_TPF); attr = hl_attr(HLF_TPF);
maxwidth = Columns; maxwidth = Columns;
# ifdef FEAT_EVAL # ifdef FEAT_EVAL
use_sandbox = was_set_insecurely((char_u *)"tabline"); use_sandbox = was_set_insecurely((char_u *)"tabline", 0);
# endif # endif
} }
else else
@ -5643,7 +5649,7 @@ win_redr_custom(wp, draw_ruler)
} }
# ifdef FEAT_EVAL # ifdef FEAT_EVAL
use_sandbox = was_set_insecurely((char_u *)"rulerformat"); use_sandbox = was_set_insecurely((char_u *)"rulerformat", 0);
# endif # endif
} }
else else
@ -5653,7 +5659,8 @@ win_redr_custom(wp, draw_ruler)
else else
p = p_stl; p = p_stl;
# ifdef FEAT_EVAL # ifdef FEAT_EVAL
use_sandbox = was_set_insecurely((char_u *)"statusline"); use_sandbox = was_set_insecurely((char_u *)"statusline",
*wp->w_p_stl == NUL ? 0 : OPT_LOCAL);
# endif # endif
} }
@ -5668,7 +5675,7 @@ win_redr_custom(wp, draw_ruler)
width = build_stl_str_hl(wp == NULL ? curwin : wp, width = build_stl_str_hl(wp == NULL ? curwin : wp,
buf, sizeof(buf), buf, sizeof(buf),
p, use_sandbox, p, use_sandbox,
fillchar, maxwidth, hl); fillchar, maxwidth, hltab, tabtab);
len = STRLEN(buf); len = STRLEN(buf);
while (width < maxwidth && len < sizeof(buf) - 1) while (width < maxwidth && len < sizeof(buf) - 1)
@ -5682,27 +5689,49 @@ win_redr_custom(wp, draw_ruler)
} }
buf[len] = NUL; buf[len] = NUL;
/*
* Draw each snippet with the specified highlighting.
*/
curattr = attr; curattr = attr;
p = buf; p = buf;
for (n = 0; hl[n].start != NULL; n++) for (n = 0; hltab[n].start != NULL; n++)
{ {
len = (int)(hl[n].start - p); len = (int)(hltab[n].start - p);
screen_puts_len(p, len, row, col, curattr); screen_puts_len(p, len, row, col, curattr);
col += vim_strnsize(p, len); col += vim_strnsize(p, len);
p = hl[n].start; p = hltab[n].start;
if (hl[n].userhl == 0) if (hltab[n].userhl == 0)
curattr = attr; curattr = attr;
else if (hl[n].userhl < 0) else if (hltab[n].userhl < 0)
curattr = syn_id2attr(-hl[n].userhl); curattr = syn_id2attr(-hltab[n].userhl);
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
else if (wp != NULL && wp != curwin && wp->w_status_height != 0) else if (wp != NULL && wp != curwin && wp->w_status_height != 0)
curattr = highlight_stlnc[hl[n].userhl - 1]; curattr = highlight_stlnc[hltab[n].userhl - 1];
#endif #endif
else else
curattr = highlight_user[hl[n].userhl - 1]; curattr = highlight_user[hltab[n].userhl - 1];
} }
screen_puts(p, row, col, curattr); screen_puts(p, row, col, curattr);
if (wp == NULL)
{
/* Fill the TabPageIdxs[] array for clicking in the tab pagesline. */
col = 0;
len = 0;
p = buf;
fillchar = 0;
for (n = 0; tabtab[n].start != NULL; n++)
{
len += vim_strnsize(p, (int)(tabtab[n].start - p));
while (col < len)
TabPageIdxs[col++] = fillchar;
p = tabtab[n].start;
fillchar = tabtab[n].userhl;
}
while (col < Columns)
TabPageIdxs[col++] = fillchar;
}
} }
#endif /* FEAT_STL_OPT */ #endif /* FEAT_STL_OPT */
@ -6198,7 +6227,8 @@ screen_start_highlight(attr)
{ {
char buf[20]; char buf[20];
sprintf(buf, IF_EB("\033|%dh", ESC_STR "|%dh"), attr); /* internal GUI code */ /* The GUI handles this internally. */
sprintf(buf, IF_EB("\033|%dh", ESC_STR "|%dh"), attr);
OUT_STR(buf); OUT_STR(buf);
} }
else else
@ -6207,14 +6237,7 @@ screen_start_highlight(attr)
if (attr > HL_ALL) /* special HL attr. */ if (attr > HL_ALL) /* special HL attr. */
{ {
if (t_colors > 1) if (t_colors > 1)
{
aep = syn_cterm_attr2entry(attr); aep = syn_cterm_attr2entry(attr);
/* If the Normal FG color has BOLD attribute and the new
* HL has a FG color defined, clear BOLD. */
if (aep != NULL && aep->ae_u.cterm.fg_color
&& cterm_normal_fg_bold)
out_str(T_ME);
}
else else
aep = syn_term_attr2entry(attr); aep = syn_term_attr2entry(attr);
if (aep == NULL) /* did ":syntax clear" */ if (aep == NULL) /* did ":syntax clear" */
@ -6224,6 +6247,11 @@ screen_start_highlight(attr)
} }
if ((attr & HL_BOLD) && T_MD != NULL) /* bold */ if ((attr & HL_BOLD) && T_MD != NULL) /* bold */
out_str(T_MD); out_str(T_MD);
else if (aep != NULL && t_colors > 1 && aep->ae_u.cterm.fg_color
&& cterm_normal_fg_bold)
/* If the Normal FG color has BOLD attribute and the new HL
* has a FG color defined, clear BOLD. */
out_str(T_ME);
if ((attr & HL_STANDOUT) && T_SO != NULL) /* standout */ if ((attr & HL_STANDOUT) && T_SO != NULL) /* standout */
out_str(T_SO); out_str(T_SO);
if ((attr & (HL_UNDERLINE | HL_UNDERCURL)) && T_US != NULL) if ((attr & (HL_UNDERLINE | HL_UNDERCURL)) && T_US != NULL)
@ -6808,7 +6836,7 @@ screenalloc(clear)
unsigned *new_LineOffset; unsigned *new_LineOffset;
char_u *new_LineWraps; char_u *new_LineWraps;
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
char_u *new_TabPageIdxs; short *new_TabPageIdxs;
tabpage_T *tp; tabpage_T *tp;
#endif #endif
static int entered = FALSE; /* avoid recursiveness */ static int entered = FALSE; /* avoid recursiveness */
@ -6885,7 +6913,7 @@ screenalloc(clear)
Rows * sizeof(unsigned)), FALSE); Rows * sizeof(unsigned)), FALSE);
new_LineWraps = (char_u *)lalloc((long_u)(Rows * sizeof(char_u)), FALSE); new_LineWraps = (char_u *)lalloc((long_u)(Rows * sizeof(char_u)), FALSE);
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
new_TabPageIdxs = (char_u *)lalloc((long_u)(Columns * sizeof(char_u)), FALSE); new_TabPageIdxs = (short *)lalloc((long_u)(Columns * sizeof(short)), FALSE);
#endif #endif
FOR_ALL_TAB_WINDOWS(tp, wp) FOR_ALL_TAB_WINDOWS(tp, wp)
@ -8553,6 +8581,11 @@ draw_tabline()
return; return;
#if defined(FEAT_STL_OPT) #if defined(FEAT_STL_OPT)
/* Init TabPageIdxs[] to zero: Clicking outside of tabs has no effect. */
for (scol = 0; scol < Columns; ++scol)
TabPageIdxs[scol] = 0;
/* Use the 'tabline' option if it's set. */ /* Use the 'tabline' option if it's set. */
if (*p_tal != NUL) if (*p_tal != NUL)
{ {
@ -8563,8 +8596,13 @@ draw_tabline()
called_emsg = FALSE; called_emsg = FALSE;
win_redr_custom(NULL, FALSE); win_redr_custom(NULL, FALSE);
if (called_emsg) if (called_emsg)
{
set_string_option_direct((char_u *)"tabline", -1, set_string_option_direct((char_u *)"tabline", -1,
(char_u *)"", OPT_FREE); (char_u *)"", OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"tabline", SID_ERROR);
# endif
}
called_emsg |= save_called_emsg; called_emsg |= save_called_emsg;
} }
else else
@ -8579,6 +8617,7 @@ draw_tabline()
attr = attr_nosel; attr = attr_nosel;
tabcount = 0; tabcount = 0;
scol = 0;
for (tp = first_tabpage; tp != NULL && col < Columns; tp = tp->tp_next) for (tp = first_tabpage; tp != NULL && col < Columns; tp = tp->tp_next)
{ {
scol = col; scol = col;
@ -8671,15 +8710,14 @@ draw_tabline()
else else
c = ' '; c = ' ';
screen_fill(0, 1, col, (int)Columns, c, c, attr_fill); screen_fill(0, 1, col, (int)Columns, c, c, attr_fill);
/* Put an "X" for closing the current tab if there are several. */
if (first_tabpage->tp_next != NULL)
{
screen_putchar('X', 0, (int)Columns - 1, attr_nosel);
TabPageIdxs[Columns - 1] = -999;
}
} }
/* Put an "X" for closing the current tab if there are several. */
if (first_tabpage->tp_next != NULL)
screen_putchar('X', 0, (int)Columns - 1, attr_nosel);
/* Clicking outside of tabs has no effect. */
while (scol < Columns)
TabPageIdxs[scol++] = 0xff;
} }
#endif #endif
@ -8852,8 +8890,13 @@ win_redr_ruler(wp, always)
called_emsg = FALSE; called_emsg = FALSE;
win_redr_custom(wp, TRUE); win_redr_custom(wp, TRUE);
if (called_emsg) if (called_emsg)
{
set_string_option_direct((char_u *)"rulerformat", -1, set_string_option_direct((char_u *)"rulerformat", -1,
(char_u *)"", OPT_FREE); (char_u *)"", OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"rulerformat", SID_ERROR);
# endif
}
called_emsg |= save_called_emsg; called_emsg |= save_called_emsg;
return; return;
} }

View File

@ -4499,7 +4499,7 @@ find_pattern_in_path(ptr, dir, len, whole, skip_comments,
else else
/* Use text after match with 'include'. */ /* Use text after match with 'include'. */
new_fname = file_name_in_line(incl_regmatch.endp[0], 0, new_fname = file_name_in_line(incl_regmatch.endp[0], 0,
FNAME_EXP|FNAME_INCL|FNAME_REL, 1L, p_fname); FNAME_EXP|FNAME_INCL|FNAME_REL, 1L, p_fname, NULL);
already_searched = FALSE; already_searched = FALSE;
if (new_fname != NULL) if (new_fname != NULL)
{ {
@ -4829,7 +4829,7 @@ search_line:
goto exit_matched; goto exit_matched;
} }
add_r = ins_compl_add_infercase(aux, i, add_r = ins_compl_add_infercase(aux, i, p_ic,
curr_fname == curbuf->b_fname ? NULL : curr_fname, curr_fname == curbuf->b_fname ? NULL : curr_fname,
dir, reuse); dir, reuse);
if (add_r == OK) if (add_r == OK)

View File

@ -1324,14 +1324,17 @@ struct file_buffer
char_u *b_p_inc; /* 'include' */ char_u *b_p_inc; /* 'include' */
# ifdef FEAT_EVAL # ifdef FEAT_EVAL
char_u *b_p_inex; /* 'includeexpr' */ char_u *b_p_inex; /* 'includeexpr' */
long_u b_p_inex_flags; /* flags for 'includeexpr' */
# endif # endif
#endif #endif
#if defined(FEAT_CINDENT) && defined(FEAT_EVAL) #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
char_u *b_p_inde; /* 'indentexpr' */ char_u *b_p_inde; /* 'indentexpr' */
long_u b_p_inde_flags; /* flags for 'indentexpr' */
char_u *b_p_indk; /* 'indentkeys' */ char_u *b_p_indk; /* 'indentkeys' */
#endif #endif
#if defined(FEAT_EVAL) #if defined(FEAT_EVAL)
char_u *b_p_fex; /* 'formatexpr' */ char_u *b_p_fex; /* 'formatexpr' */
long_u b_p_fex_flags; /* flags for 'formatexpr' */
#endif #endif
#ifdef FEAT_CRYPT #ifdef FEAT_CRYPT
char_u *b_p_key; /* 'key' */ char_u *b_p_key; /* 'key' */
@ -1826,6 +1829,15 @@ struct window_S
winopt_T w_onebuf_opt; winopt_T w_onebuf_opt;
winopt_T w_allbuf_opt; winopt_T w_allbuf_opt;
/* A few options have local flags for P_INSECURE. */
#ifdef FEAT_STL_OPT
long_u w_p_stl_flags; /* flags for 'statusline' */
#endif
#ifdef FEAT_EVAL
long_u w_p_fde_flags; /* flags for 'foldexpr' */
long_u w_p_fdt_flags; /* flags for 'foldtext' */
#endif
/* transform a pointer to a "onebuf" option into a "allbuf" option */ /* transform a pointer to a "onebuf" option into a "allbuf" option */
#define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T)) #define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T))

View File

@ -1562,6 +1562,9 @@ set_color_count(nr)
else else
*nr_colors = NUL; *nr_colors = NUL;
set_string_option_direct((char_u *)"t_Co", -1, nr_colors, OPT_FREE); set_string_option_direct((char_u *)"t_Co", -1, nr_colors, OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"t_Co", current_SID);
# endif
} }
#endif #endif
@ -2501,6 +2504,9 @@ termcapinit(name)
if (term == NULL || *term == NUL) if (term == NULL || *term == NUL)
term = DEFAULT_TERM; term = DEFAULT_TERM;
set_string_option_direct((char_u *)"term", -1, term, OPT_FREE); set_string_option_direct((char_u *)"term", -1, term, OPT_FREE);
# ifdef FEAT_EVAL
set_option_scriptID((char_u *)"term", current_SID);
# endif
/* Set the default terminal name. */ /* Set the default terminal name. */
set_string_default("term", term); set_string_default("term", term);

View File

@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA" #define VIM_VERSION_MEDIUM "7.0aa ALPHA"
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 21)" #define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 22)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 21, compiled " #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 22, compiled "

View File

@ -1035,6 +1035,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define SID_CMDARG -2 /* for "--cmd" argument */ #define SID_CMDARG -2 /* for "--cmd" argument */
#define SID_CARG -3 /* for "-c" argument */ #define SID_CARG -3 /* for "-c" argument */
#define SID_ENV -4 /* for sourcing environment variable */ #define SID_ENV -4 /* for sourcing environment variable */
#define SID_ERROR -5 /* option was reset because of an error */
/* /*
* Events for autocommands. * Events for autocommands.

View File

@ -105,6 +105,7 @@ do_window(nchar, Prenum, xchar)
win_T *wp; win_T *wp;
#if defined(FEAT_SEARCHPATH) || defined(FEAT_FIND_ID) #if defined(FEAT_SEARCHPATH) || defined(FEAT_FIND_ID)
char_u *ptr; char_u *ptr;
linenr_T lnum = -1;
#endif #endif
#ifdef FEAT_FIND_ID #ifdef FEAT_FIND_ID
int type = FIND_DEFINE; int type = FIND_DEFINE;
@ -478,10 +479,11 @@ newwindow:
#ifdef FEAT_SEARCHPATH #ifdef FEAT_SEARCHPATH
/* edit file name under cursor in a new window */ /* edit file name under cursor in a new window */
case 'f': case 'f':
case 'F':
case Ctrl_F: case Ctrl_F:
CHECK_CMDWIN CHECK_CMDWIN
ptr = grab_file_name(Prenum1); ptr = grab_file_name(Prenum1, &lnum);
if (ptr != NULL) if (ptr != NULL)
{ {
#ifdef FEAT_GUI #ifdef FEAT_GUI
@ -493,8 +495,13 @@ newwindow:
# ifdef FEAT_SCROLLBIND # ifdef FEAT_SCROLLBIND
curwin->w_p_scb = FALSE; curwin->w_p_scb = FALSE;
# endif # endif
(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, ECMD_HIDE);
ECMD_HIDE); if (nchar == 'F' && lnum >= 0)
{
curwin->w_cursor.lnum = lnum;
check_cursor_lnum();
beginline(BL_SOL | BL_FIX);
}
} }
vim_free(ptr); vim_free(ptr);
} }
@ -5081,8 +5088,9 @@ tabpageline_height()
* Returns the name in allocated memory, NULL for failure. * Returns the name in allocated memory, NULL for failure.
*/ */
char_u * char_u *
grab_file_name(count) grab_file_name(count, file_lnum)
long count; long count;
linenr_T *file_lnum;
{ {
# ifdef FEAT_VISUAL # ifdef FEAT_VISUAL
if (VIsual_active) if (VIsual_active)
@ -5096,7 +5104,9 @@ grab_file_name(count)
FNAME_MESS|FNAME_EXP|FNAME_REL, count, curbuf->b_ffname); FNAME_MESS|FNAME_EXP|FNAME_REL, count, curbuf->b_ffname);
} }
# endif # endif
return file_name_at_cursor(FNAME_MESS|FNAME_HYP|FNAME_EXP|FNAME_REL, count); return file_name_at_cursor(FNAME_MESS|FNAME_HYP|FNAME_EXP|FNAME_REL, count,
file_lnum);
} }
/* /*
@ -5113,12 +5123,14 @@ grab_file_name(count)
* FNAME_INCL apply "includeexpr" * FNAME_INCL apply "includeexpr"
*/ */
char_u * char_u *
file_name_at_cursor(options, count) file_name_at_cursor(options, count, file_lnum)
int options; int options;
long count; long count;
linenr_T *file_lnum;
{ {
return file_name_in_line(ml_get_curline(), return file_name_in_line(ml_get_curline(),
curwin->w_cursor.col, options, count, curbuf->b_ffname); curwin->w_cursor.col, options, count, curbuf->b_ffname,
file_lnum);
} }
/* /*
@ -5126,12 +5138,13 @@ file_name_at_cursor(options, count)
* Otherwise like file_name_at_cursor(). * Otherwise like file_name_at_cursor().
*/ */
char_u * char_u *
file_name_in_line(line, col, options, count, rel_fname) file_name_in_line(line, col, options, count, rel_fname, file_lnum)
char_u *line; char_u *line;
int col; int col;
int options; int options;
long count; long count;
char_u *rel_fname; /* file we are searching relative to */ char_u *rel_fname; /* file we are searching relative to */
linenr_T *file_lnum; /* line number after the file name */
{ {
char_u *ptr; char_u *ptr;
int len; int len;
@ -5189,6 +5202,23 @@ file_name_in_line(line, col, options, count, rel_fname)
&& ptr[len - 2] != '.') && ptr[len - 2] != '.')
--len; --len;
if (file_lnum != NULL)
{
char_u *p;
/* Get the number after the file name and a separator character */
p = ptr + len;
p = skipwhite(p);
if (*p != NUL)
{
if (!isdigit(*p))
++p; /* skip the separator */
p = skipwhite(p);
if (isdigit(*p))
*file_lnum = (int)getdigits(&p);
}
}
return find_file_name_in_path(ptr, len, options, count, rel_fname); return find_file_name_in_path(ptr, len, options, count, rel_fname);
} }
@ -5204,7 +5234,7 @@ eval_includeexpr(ptr, len)
set_vim_var_string(VV_FNAME, ptr, len); set_vim_var_string(VV_FNAME, ptr, len);
res = eval_to_string_safe(curbuf->b_p_inex, NULL, res = eval_to_string_safe(curbuf->b_p_inex, NULL,
was_set_insecurely((char_u *)"includeexpr")); was_set_insecurely((char_u *)"includeexpr", OPT_LOCAL));
set_vim_var_string(VV_FNAME, NULL, 0); set_vim_var_string(VV_FNAME, NULL, 0);
return res; return res;
} }