|
Karsten Hopp |
ab04bc |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
ab04bc |
Subject: Patch 7.4.786
|
|
Karsten Hopp |
ab04bc |
Fcc: outbox
|
|
Karsten Hopp |
ab04bc |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
ab04bc |
Mime-Version: 1.0
|
|
Karsten Hopp |
ab04bc |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
ab04bc |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
ab04bc |
------------
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
Patch 7.4.786
|
|
Karsten Hopp |
ab04bc |
Problem: It is not possible for a plugin to adjust to a changed setting.
|
|
Karsten Hopp |
ab04bc |
Solution: Add the OptionSet autocommand event. (Christian Brabandt)
|
|
Karsten Hopp |
ab04bc |
Files: runtime/doc/autocmd.txt, runtime/doc/eval.txt, src/eval.c,
|
|
Karsten Hopp |
ab04bc |
src/fileio.c, src/option.c, src/proto/eval.pro,
|
|
Karsten Hopp |
ab04bc |
src/testdir/Make_amiga.mak, src/testdir/Make_dos.mak,
|
|
Karsten Hopp |
ab04bc |
src/testdir/Make_ming.mak, src/testdir/Make_os2.mak,
|
|
Karsten Hopp |
ab04bc |
src/testdir/Make_vms.mms, src/testdir/Makefile,
|
|
Karsten Hopp |
ab04bc |
src/testdir/test_autocmd_option.in,
|
|
Karsten Hopp |
ab04bc |
src/testdir/test_autocmd_option.ok, src/vim.h
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/runtime/doc/autocmd.txt 2015-07-10 17:56:18.211777230 +0200
|
|
Karsten Hopp |
ab04bc |
--- runtime/doc/autocmd.txt 2015-07-17 15:03:42.523751972 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 259,264 ****
|
|
Karsten Hopp |
ab04bc |
--- 259,265 ----
|
|
Karsten Hopp |
ab04bc |
|Syntax| when the 'syntax' option has been set
|
|
Karsten Hopp |
ab04bc |
|EncodingChanged| after the 'encoding' option has been changed
|
|
Karsten Hopp |
ab04bc |
|TermChanged| after the value of 'term' has changed
|
|
Karsten Hopp |
ab04bc |
+ |OptionSet| after setting any option
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
Startup and exit
|
|
Karsten Hopp |
ab04bc |
|VimEnter| after doing all the startup stuff
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 732,737 ****
|
|
Karsten Hopp |
ab04bc |
--- 745,771 ----
|
|
Karsten Hopp |
ab04bc |
o Operator-pending
|
|
Karsten Hopp |
ab04bc |
i Insert
|
|
Karsten Hopp |
ab04bc |
c Command line
|
|
Karsten Hopp |
ab04bc |
+ *OptionSet*
|
|
Karsten Hopp |
ab04bc |
+ OptionSet After setting an option. The pattern is
|
|
Karsten Hopp |
ab04bc |
+ matched against the long option name.
|
|
Karsten Hopp |
ab04bc |
+ The |v:option_old| variable indicates the
|
|
Karsten Hopp |
ab04bc |
+ old option value, |v:option_new| variable
|
|
Karsten Hopp |
ab04bc |
+ indicates the newly set value, the
|
|
Karsten Hopp |
ab04bc |
+ |v:option_type| variable indicates whether
|
|
Karsten Hopp |
ab04bc |
+ it's global or local scoped and |<amatch>|
|
|
Karsten Hopp |
ab04bc |
+ indicates what option has been set.
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ Is not triggered on startup and for the 'key'
|
|
Karsten Hopp |
ab04bc |
+ option for obvious reasons.
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ Note: It's a bad idea, to reset an option
|
|
Karsten Hopp |
ab04bc |
+ during this autocommand, since this will
|
|
Karsten Hopp |
ab04bc |
+ probably break plugins. You can always use
|
|
Karsten Hopp |
ab04bc |
+ |noa| to prevent triggering this autocommand.
|
|
Karsten Hopp |
ab04bc |
+ Could be used, to check for existence of the
|
|
Karsten Hopp |
ab04bc |
+ 'backupdir' and 'undodir' options and create
|
|
Karsten Hopp |
ab04bc |
+ directories, if they don't exist yet.
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
*QuickFixCmdPre*
|
|
Karsten Hopp |
ab04bc |
QuickFixCmdPre Before a quickfix command is run (|:make|,
|
|
Karsten Hopp |
ab04bc |
|:lmake|, |:grep|, |:lgrep|, |:grepadd|,
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/runtime/doc/eval.txt 2015-07-10 17:56:18.211777230 +0200
|
|
Karsten Hopp |
ab04bc |
--- runtime/doc/eval.txt 2015-07-17 15:05:12.834890842 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 1533,1538 ****
|
|
Karsten Hopp |
ab04bc |
--- 1535,1549 ----
|
|
Karsten Hopp |
ab04bc |
than String this will cause trouble.
|
|
Karsten Hopp |
ab04bc |
{only when compiled with the |+viminfo| feature}
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
+ *v:option_new*
|
|
Karsten Hopp |
ab04bc |
+ v:option_new New value of the option. Valid while executing an |OptionSet|
|
|
Karsten Hopp |
ab04bc |
+ autocommand.
|
|
Karsten Hopp |
ab04bc |
+ *v:option_old*
|
|
Karsten Hopp |
ab04bc |
+ v:option_old Old value of the option. Valid while executing an |OptionSet|
|
|
Karsten Hopp |
ab04bc |
+ autocommand.
|
|
Karsten Hopp |
ab04bc |
+ *v:option_type*
|
|
Karsten Hopp |
ab04bc |
+ v:option_type Scope of the set command. Valid while executing an
|
|
Karsten Hopp |
ab04bc |
+ |OptionSet| autocommand. Can be either "global" or "local"
|
|
Karsten Hopp |
ab04bc |
*v:operator* *operator-variable*
|
|
Karsten Hopp |
ab04bc |
v:operator The last operator given in Normal mode. This is a single
|
|
Karsten Hopp |
ab04bc |
character except for commands starting with <g> or <z>,
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/eval.c 2015-07-17 13:03:42.096357579 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/eval.c 2015-07-17 15:07:24.513630864 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 365,370 ****
|
|
Karsten Hopp |
ab04bc |
--- 365,373 ----
|
|
Karsten Hopp |
ab04bc |
{VV_NAME("windowid", VAR_NUMBER), VV_RO},
|
|
Karsten Hopp |
ab04bc |
{VV_NAME("progpath", VAR_STRING), VV_RO},
|
|
Karsten Hopp |
ab04bc |
{VV_NAME("completed_item", VAR_DICT), VV_RO},
|
|
Karsten Hopp |
ab04bc |
+ {VV_NAME("option_new", VAR_STRING), VV_RO},
|
|
Karsten Hopp |
ab04bc |
+ {VV_NAME("option_old", VAR_STRING), VV_RO},
|
|
Karsten Hopp |
ab04bc |
+ {VV_NAME("option_type", VAR_STRING), VV_RO},
|
|
Karsten Hopp |
ab04bc |
};
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
/* shorthand */
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 24720,24725 ****
|
|
Karsten Hopp |
ab04bc |
--- 24723,24738 ----
|
|
Karsten Hopp |
ab04bc |
}
|
|
Karsten Hopp |
ab04bc |
}
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
+ /* reset v:option_new, v:option_old and v:option_type */
|
|
Karsten Hopp |
ab04bc |
+ void
|
|
Karsten Hopp |
ab04bc |
+ reset_v_option_vars()
|
|
Karsten Hopp |
ab04bc |
+ {
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_NEW, NULL, -1);
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_OLD, NULL, -1);
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_TYPE, NULL, -1);
|
|
Karsten Hopp |
ab04bc |
+ }
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
#endif /* FEAT_EVAL */
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/fileio.c 2015-07-17 14:16:49.846596759 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/fileio.c 2015-07-17 14:58:39.362642959 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 7699,7704 ****
|
|
Karsten Hopp |
ab04bc |
--- 7699,7705 ----
|
|
Karsten Hopp |
ab04bc |
{"InsertLeave", EVENT_INSERTLEAVE},
|
|
Karsten Hopp |
ab04bc |
{"InsertCharPre", EVENT_INSERTCHARPRE},
|
|
Karsten Hopp |
ab04bc |
{"MenuPopup", EVENT_MENUPOPUP},
|
|
Karsten Hopp |
ab04bc |
+ {"OptionSet", EVENT_OPTIONSET},
|
|
Karsten Hopp |
ab04bc |
{"QuickFixCmdPost", EVENT_QUICKFIXCMDPOST},
|
|
Karsten Hopp |
ab04bc |
{"QuickFixCmdPre", EVENT_QUICKFIXCMDPRE},
|
|
Karsten Hopp |
ab04bc |
{"QuitPre", EVENT_QUITPRE},
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 7736,7742 ****
|
|
Karsten Hopp |
ab04bc |
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
|
Karsten Hopp |
ab04bc |
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
|
Karsten Hopp |
ab04bc |
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
|
Karsten Hopp |
ab04bc |
! NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
|
Karsten Hopp |
ab04bc |
};
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
/*
|
|
Karsten Hopp |
ab04bc |
--- 7737,7743 ----
|
|
Karsten Hopp |
ab04bc |
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
|
Karsten Hopp |
ab04bc |
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
|
Karsten Hopp |
ab04bc |
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
|
Karsten Hopp |
ab04bc |
! NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
|
Karsten Hopp |
ab04bc |
};
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
/*
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 9321,9327 ****
|
|
Karsten Hopp |
ab04bc |
*/
|
|
Karsten Hopp |
ab04bc |
if (fname_io == NULL)
|
|
Karsten Hopp |
ab04bc |
{
|
|
Karsten Hopp |
ab04bc |
! if (event == EVENT_COLORSCHEME)
|
|
Karsten Hopp |
ab04bc |
autocmd_fname = NULL;
|
|
Karsten Hopp |
ab04bc |
else if (fname != NULL && *fname != NUL)
|
|
Karsten Hopp |
ab04bc |
autocmd_fname = fname;
|
|
Karsten Hopp |
ab04bc |
--- 9322,9328 ----
|
|
Karsten Hopp |
ab04bc |
*/
|
|
Karsten Hopp |
ab04bc |
if (fname_io == NULL)
|
|
Karsten Hopp |
ab04bc |
{
|
|
Karsten Hopp |
ab04bc |
! if (event == EVENT_COLORSCHEME || event == EVENT_OPTIONSET)
|
|
Karsten Hopp |
ab04bc |
autocmd_fname = NULL;
|
|
Karsten Hopp |
ab04bc |
else if (fname != NULL && *fname != NUL)
|
|
Karsten Hopp |
ab04bc |
autocmd_fname = fname;
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 9385,9390 ****
|
|
Karsten Hopp |
ab04bc |
--- 9386,9392 ----
|
|
Karsten Hopp |
ab04bc |
|| event == EVENT_SPELLFILEMISSING
|
|
Karsten Hopp |
ab04bc |
|| event == EVENT_QUICKFIXCMDPRE
|
|
Karsten Hopp |
ab04bc |
|| event == EVENT_COLORSCHEME
|
|
Karsten Hopp |
ab04bc |
+ || event == EVENT_OPTIONSET
|
|
Karsten Hopp |
ab04bc |
|| event == EVENT_QUICKFIXCMDPOST)
|
|
Karsten Hopp |
ab04bc |
fname = vim_strsave(fname);
|
|
Karsten Hopp |
ab04bc |
else
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/option.c 2015-07-17 14:16:49.850596721 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/option.c 2015-07-17 17:30:22.703747129 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 4592,4600 ****
|
|
Karsten Hopp |
ab04bc |
{
|
|
Karsten Hopp |
ab04bc |
char_u *save_arg = NULL;
|
|
Karsten Hopp |
ab04bc |
char_u *s = NULL;
|
|
Karsten Hopp |
ab04bc |
! char_u *oldval; /* previous value if *varp */
|
|
Karsten Hopp |
ab04bc |
char_u *newval;
|
|
Karsten Hopp |
ab04bc |
! char_u *origval;
|
|
Karsten Hopp |
ab04bc |
unsigned newlen;
|
|
Karsten Hopp |
ab04bc |
int comma;
|
|
Karsten Hopp |
ab04bc |
int bs;
|
|
Karsten Hopp |
ab04bc |
--- 4592,4603 ----
|
|
Karsten Hopp |
ab04bc |
{
|
|
Karsten Hopp |
ab04bc |
char_u *save_arg = NULL;
|
|
Karsten Hopp |
ab04bc |
char_u *s = NULL;
|
|
Karsten Hopp |
ab04bc |
! char_u *oldval = NULL; /* previous value if *varp */
|
|
Karsten Hopp |
ab04bc |
char_u *newval;
|
|
Karsten Hopp |
ab04bc |
! char_u *origval = NULL;
|
|
Karsten Hopp |
ab04bc |
! #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
|
Karsten Hopp |
ab04bc |
! char_u *saved_origval = NULL;
|
|
Karsten Hopp |
ab04bc |
! #endif
|
|
Karsten Hopp |
ab04bc |
unsigned newlen;
|
|
Karsten Hopp |
ab04bc |
int comma;
|
|
Karsten Hopp |
ab04bc |
int bs;
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 4914,4919 ****
|
|
Karsten Hopp |
ab04bc |
--- 4917,4930 ----
|
|
Karsten Hopp |
ab04bc |
/* Set the new value. */
|
|
Karsten Hopp |
ab04bc |
*(char_u **)(varp) = newval;
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
+ #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
|
Karsten Hopp |
ab04bc |
+ if (!starting && options[opt_idx].indir != PV_KEY
|
|
Karsten Hopp |
ab04bc |
+ && origval != NULL)
|
|
Karsten Hopp |
ab04bc |
+ /* origval may be freed by
|
|
Karsten Hopp |
ab04bc |
+ * did_set_string_option(), make a copy. */
|
|
Karsten Hopp |
ab04bc |
+ saved_origval = vim_strsave(origval);
|
|
Karsten Hopp |
ab04bc |
+ #endif
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
/* Handle side effects, and set the global value for
|
|
Karsten Hopp |
ab04bc |
* ":set" on local options. */
|
|
Karsten Hopp |
ab04bc |
errmsg = did_set_string_option(opt_idx, (char_u **)varp,
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 4922,4927 ****
|
|
Karsten Hopp |
ab04bc |
--- 4933,4956 ----
|
|
Karsten Hopp |
ab04bc |
/* If error detected, print the error message. */
|
|
Karsten Hopp |
ab04bc |
if (errmsg != NULL)
|
|
Karsten Hopp |
ab04bc |
goto skip;
|
|
Karsten Hopp |
ab04bc |
+ #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
|
Karsten Hopp |
ab04bc |
+ if (saved_origval != NULL)
|
|
Karsten Hopp |
ab04bc |
+ {
|
|
Karsten Hopp |
ab04bc |
+ char_u buf_type[7];
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ sprintf((char *)buf_type, "%s",
|
|
Karsten Hopp |
ab04bc |
+ (opt_flags & OPT_LOCAL) ? "local" : "global");
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_NEW, newval, -1);
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_OLD, saved_origval, -1);
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
|
|
Karsten Hopp |
ab04bc |
+ apply_autocmds(EVENT_OPTIONSET,
|
|
Karsten Hopp |
ab04bc |
+ (char_u *)options[opt_idx].fullname,
|
|
Karsten Hopp |
ab04bc |
+ NULL, FALSE, NULL);
|
|
Karsten Hopp |
ab04bc |
+ reset_v_option_vars();
|
|
Karsten Hopp |
ab04bc |
+ vim_free(saved_origval);
|
|
Karsten Hopp |
ab04bc |
+ }
|
|
Karsten Hopp |
ab04bc |
+ #endif
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
}
|
|
Karsten Hopp |
ab04bc |
else /* key code option */
|
|
Karsten Hopp |
ab04bc |
{
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 5668,5673 ****
|
|
Karsten Hopp |
ab04bc |
--- 5697,5705 ----
|
|
Karsten Hopp |
ab04bc |
char_u *s;
|
|
Karsten Hopp |
ab04bc |
char_u **varp;
|
|
Karsten Hopp |
ab04bc |
char_u *oldval;
|
|
Karsten Hopp |
ab04bc |
+ #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
|
Karsten Hopp |
ab04bc |
+ char_u *saved_oldval = NULL;
|
|
Karsten Hopp |
ab04bc |
+ #endif
|
|
Karsten Hopp |
ab04bc |
char_u *r = NULL;
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
if (options[opt_idx].var == NULL) /* don't set hidden option */
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 5683,5691 ****
|
|
Karsten Hopp |
ab04bc |
--- 5715,5744 ----
|
|
Karsten Hopp |
ab04bc |
: opt_flags);
|
|
Karsten Hopp |
ab04bc |
oldval = *varp;
|
|
Karsten Hopp |
ab04bc |
*varp = s;
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
|
Karsten Hopp |
ab04bc |
+ if (!starting && options[opt_idx].indir != PV_KEY)
|
|
Karsten Hopp |
ab04bc |
+ saved_oldval = vim_strsave(oldval);
|
|
Karsten Hopp |
ab04bc |
+ #endif
|
|
Karsten Hopp |
ab04bc |
if ((r = did_set_string_option(opt_idx, varp, TRUE, oldval, NULL,
|
|
Karsten Hopp |
ab04bc |
opt_flags)) == NULL)
|
|
Karsten Hopp |
ab04bc |
did_set_option(opt_idx, opt_flags, TRUE);
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ /* call autocomamnd after handling side effects */
|
|
Karsten Hopp |
ab04bc |
+ #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
|
Karsten Hopp |
ab04bc |
+ if (saved_oldval != NULL)
|
|
Karsten Hopp |
ab04bc |
+ {
|
|
Karsten Hopp |
ab04bc |
+ char_u buf_type[7];
|
|
Karsten Hopp |
ab04bc |
+ sprintf((char *)buf_type, "%s",
|
|
Karsten Hopp |
ab04bc |
+ (opt_flags & OPT_LOCAL) ? "local" : "global");
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_NEW, s, -1);
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_OLD, oldval, -1);
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
|
|
Karsten Hopp |
ab04bc |
+ apply_autocmds(EVENT_OPTIONSET, (char_u *)options[opt_idx].fullname, NULL, FALSE, NULL);
|
|
Karsten Hopp |
ab04bc |
+ reset_v_option_vars();
|
|
Karsten Hopp |
ab04bc |
+ vim_free(saved_oldval);
|
|
Karsten Hopp |
ab04bc |
+ }
|
|
Karsten Hopp |
ab04bc |
+ #endif
|
|
Karsten Hopp |
ab04bc |
}
|
|
Karsten Hopp |
ab04bc |
return r;
|
|
Karsten Hopp |
ab04bc |
}
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 8230,8237 ****
|
|
Karsten Hopp |
ab04bc |
--- 8283,8307 ----
|
|
Karsten Hopp |
ab04bc |
* End of handling side effects for bool options.
|
|
Karsten Hopp |
ab04bc |
*/
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
+ /* after handling side effects, call autocommand */
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
options[opt_idx].flags |= P_WAS_SET;
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
+ #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
|
Karsten Hopp |
ab04bc |
+ if (!starting)
|
|
Karsten Hopp |
ab04bc |
+ {
|
|
Karsten Hopp |
ab04bc |
+ char_u buf_old[2], buf_new[2], buf_type[7];
|
|
Karsten Hopp |
ab04bc |
+ snprintf((char *)buf_old, 2, "%d", old_value ? TRUE: FALSE);
|
|
Karsten Hopp |
ab04bc |
+ snprintf((char *)buf_new, 2, "%d", value ? TRUE: FALSE);
|
|
Karsten Hopp |
ab04bc |
+ sprintf((char *)buf_type, "%s", (opt_flags & OPT_LOCAL) ? "local" : "global");
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_OLD, buf_old, -1);
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
|
|
Karsten Hopp |
ab04bc |
+ apply_autocmds(EVENT_OPTIONSET, (char_u *) options[opt_idx].fullname, NULL, FALSE, NULL);
|
|
Karsten Hopp |
ab04bc |
+ reset_v_option_vars();
|
|
Karsten Hopp |
ab04bc |
+ }
|
|
Karsten Hopp |
ab04bc |
+ #endif
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
comp_col(); /* in case 'ruler' or 'showcmd' changed */
|
|
Karsten Hopp |
ab04bc |
if (curwin->w_curswant != MAXCOL
|
|
Karsten Hopp |
ab04bc |
&& (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0)
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 8767,8772 ****
|
|
Karsten Hopp |
ab04bc |
--- 8837,8857 ----
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
options[opt_idx].flags |= P_WAS_SET;
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
+ #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
|
Karsten Hopp |
ab04bc |
+ if (!starting && errmsg == NULL)
|
|
Karsten Hopp |
ab04bc |
+ {
|
|
Karsten Hopp |
ab04bc |
+ char_u buf_old[11], buf_new[11], buf_type[7];
|
|
Karsten Hopp |
ab04bc |
+ snprintf((char *)buf_old, 10, "%ld", old_value);
|
|
Karsten Hopp |
ab04bc |
+ snprintf((char *)buf_new, 10, "%ld", value);
|
|
Karsten Hopp |
ab04bc |
+ snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? "local" : "global");
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_OLD, buf_old, -1);
|
|
Karsten Hopp |
ab04bc |
+ set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
|
|
Karsten Hopp |
ab04bc |
+ apply_autocmds(EVENT_OPTIONSET, (char_u *) options[opt_idx].fullname, NULL, FALSE, NULL);
|
|
Karsten Hopp |
ab04bc |
+ reset_v_option_vars();
|
|
Karsten Hopp |
ab04bc |
+ }
|
|
Karsten Hopp |
ab04bc |
+ #endif
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
comp_col(); /* in case 'columns' or 'ls' changed */
|
|
Karsten Hopp |
ab04bc |
if (curwin->w_curswant != MAXCOL
|
|
Karsten Hopp |
ab04bc |
&& (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0)
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/proto/eval.pro 2015-07-10 17:56:18.219777154 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/proto/eval.pro 2015-07-17 17:14:38.408715248 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 133,138 ****
|
|
Karsten Hopp |
ab04bc |
--- 133,139 ----
|
|
Karsten Hopp |
ab04bc |
int store_session_globals __ARGS((FILE *fd));
|
|
Karsten Hopp |
ab04bc |
void last_set_msg __ARGS((scid_T scriptID));
|
|
Karsten Hopp |
ab04bc |
void ex_oldfiles __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
ab04bc |
+ void reset_v_option_vars __ARGS((void));
|
|
Karsten Hopp |
ab04bc |
int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
|
|
Karsten Hopp |
ab04bc |
char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
|
|
Karsten Hopp |
ab04bc |
/* vim: set ft=c : */
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/testdir/Make_amiga.mak 2015-07-17 14:16:49.854596682 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/testdir/Make_amiga.mak 2015-07-17 15:02:36.916377572 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 38,43 ****
|
|
Karsten Hopp |
ab04bc |
--- 38,44 ----
|
|
Karsten Hopp |
ab04bc |
test104.out test105.out test106.out test107.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_0count.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_count.out \
|
|
Karsten Hopp |
ab04bc |
+ test_autocmd_option.out \
|
|
Karsten Hopp |
ab04bc |
test_autoformat_join.out \
|
|
Karsten Hopp |
ab04bc |
test_breakindent.out \
|
|
Karsten Hopp |
ab04bc |
test_changelist.out \
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 188,193 ****
|
|
Karsten Hopp |
ab04bc |
--- 189,195 ----
|
|
Karsten Hopp |
ab04bc |
test107.out: test107.in
|
|
Karsten Hopp |
ab04bc |
test_argument_0count.out: test_argument_0count.in
|
|
Karsten Hopp |
ab04bc |
test_argument_count.out: test_argument_count.in
|
|
Karsten Hopp |
ab04bc |
+ test_autocmd_option.out: test_autocmd_option.in
|
|
Karsten Hopp |
ab04bc |
test_autoformat_join.out: test_autoformat_join.in
|
|
Karsten Hopp |
ab04bc |
test_breakindent.out: test_breakindent.in
|
|
Karsten Hopp |
ab04bc |
test_changelist.out: test_changelist.in
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/testdir/Make_dos.mak 2015-07-17 14:16:49.854596682 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/testdir/Make_dos.mak 2015-07-17 14:58:39.362642959 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 37,42 ****
|
|
Karsten Hopp |
ab04bc |
--- 37,43 ----
|
|
Karsten Hopp |
ab04bc |
test105.out test106.out test107.out\
|
|
Karsten Hopp |
ab04bc |
test_argument_0count.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_count.out \
|
|
Karsten Hopp |
ab04bc |
+ test_autocmd_option.out \
|
|
Karsten Hopp |
ab04bc |
test_autoformat_join.out \
|
|
Karsten Hopp |
ab04bc |
test_breakindent.out \
|
|
Karsten Hopp |
ab04bc |
test_changelist.out \
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/testdir/Make_ming.mak 2015-07-17 14:16:49.854596682 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/testdir/Make_ming.mak 2015-07-17 14:58:39.362642959 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 59,64 ****
|
|
Karsten Hopp |
ab04bc |
--- 59,65 ----
|
|
Karsten Hopp |
ab04bc |
test105.out test106.out test107.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_0count.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_count.out \
|
|
Karsten Hopp |
ab04bc |
+ test_autocmd_option.out \
|
|
Karsten Hopp |
ab04bc |
test_autoformat_join.out \
|
|
Karsten Hopp |
ab04bc |
test_breakindent.out \
|
|
Karsten Hopp |
ab04bc |
test_changelist.out \
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/testdir/Make_os2.mak 2015-07-17 14:16:49.854596682 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/testdir/Make_os2.mak 2015-07-17 14:58:39.362642959 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 39,44 ****
|
|
Karsten Hopp |
ab04bc |
--- 39,45 ----
|
|
Karsten Hopp |
ab04bc |
test105.out test106.out test107.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_0count.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_count.out \
|
|
Karsten Hopp |
ab04bc |
+ test_autocmd_option.out \
|
|
Karsten Hopp |
ab04bc |
test_autoformat_join.out \
|
|
Karsten Hopp |
ab04bc |
test_breakindent.out \
|
|
Karsten Hopp |
ab04bc |
test_changelist.out \
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/testdir/Make_vms.mms 2015-07-17 14:16:49.854596682 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/testdir/Make_vms.mms 2015-07-17 14:58:39.362642959 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 98,103 ****
|
|
Karsten Hopp |
ab04bc |
--- 98,104 ----
|
|
Karsten Hopp |
ab04bc |
test105.out test106.out test107.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_0count.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_count.out \
|
|
Karsten Hopp |
ab04bc |
+ test_autocmd_option.out \
|
|
Karsten Hopp |
ab04bc |
test_autoformat_join.out \
|
|
Karsten Hopp |
ab04bc |
test_breakindent.out \
|
|
Karsten Hopp |
ab04bc |
test_changelist.out \
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/testdir/Makefile 2015-07-17 14:16:49.854596682 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/testdir/Makefile 2015-07-17 14:58:39.362642959 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 35,40 ****
|
|
Karsten Hopp |
ab04bc |
--- 35,41 ----
|
|
Karsten Hopp |
ab04bc |
test104.out test105.out test106.out test107.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_0count.out \
|
|
Karsten Hopp |
ab04bc |
test_argument_count.out \
|
|
Karsten Hopp |
ab04bc |
+ test_autocmd_option.out \
|
|
Karsten Hopp |
ab04bc |
test_autoformat_join.out \
|
|
Karsten Hopp |
ab04bc |
test_breakindent.out \
|
|
Karsten Hopp |
ab04bc |
test_changelist.out \
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/testdir/test_autocmd_option.in 2015-07-17 17:13:44.769224683 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/testdir/test_autocmd_option.in 2015-07-17 14:58:39.362642959 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 0 ****
|
|
Karsten Hopp |
ab04bc |
--- 1,73 ----
|
|
Karsten Hopp |
ab04bc |
+ Test for option autocommand
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ STARTTEST
|
|
Karsten Hopp |
ab04bc |
+ :so small.vim
|
|
Karsten Hopp |
ab04bc |
+ :if !has("eval") || !has("autocmd") | e! test.ok | w! test.out | qa! | endif
|
|
Karsten Hopp |
ab04bc |
+ :fu! AutoCommand(match)
|
|
Karsten Hopp |
ab04bc |
+ : let c=g:testcase
|
|
Karsten Hopp |
ab04bc |
+ : let item=remove(g:options, 0)
|
|
Karsten Hopp |
ab04bc |
+ : let c.=printf("Expected: Name: <%s>, Oldval: <%s>, NewVal: <%s>, Scope: <%s>\n", item[0], item[1], item[2], item[3])
|
|
Karsten Hopp |
ab04bc |
+ : let c.=printf("Autocmd Option: <%s>,", a:match)
|
|
Karsten Hopp |
ab04bc |
+ : let c.=printf(" OldVal: <%s>,", v:option_old)
|
|
Karsten Hopp |
ab04bc |
+ : let c.=printf(" NewVal: <%s>,", v:option_new)
|
|
Karsten Hopp |
ab04bc |
+ : let c.=printf(" Scope: <%s>\n", v:option_type)
|
|
Karsten Hopp |
ab04bc |
+ : call setreg('r', printf("%s\n%s", getreg('r'), c))
|
|
Karsten Hopp |
ab04bc |
+ :endfu
|
|
Karsten Hopp |
ab04bc |
+ :au OptionSet * :call AutoCommand(expand("<amatch>"))
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="1: Setting number option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['number', 0, 1, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :set nu
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="2: Setting local number option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['number', 1, 0, 'local']]
|
|
Karsten Hopp |
ab04bc |
+ :setlocal nonu
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="3: Setting global number option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['number', 1, 0, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :setglobal nonu
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="4: Setting local autoindent option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoindent', 0, 1, 'local']]
|
|
Karsten Hopp |
ab04bc |
+ :setlocal ai
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="5: Setting global autoindent option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoindent', 0, 1, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :setglobal ai
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="6: Setting global autoindent option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoindent', 1, 0, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :set ai!
|
|
Karsten Hopp |
ab04bc |
+ : Should not print anything, use :noa
|
|
Karsten Hopp |
ab04bc |
+ :noa :set nonu
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="7: Setting several global list and number option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['list', 0, 1, 'global'], ['number', 0, 1, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :set list nu
|
|
Karsten Hopp |
ab04bc |
+ :noa set nolist nonu
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="8: Setting global acd\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autochdir', 0, 1, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :setlocal acd
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="9: Setting global autoread\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoread', 0, 1, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :set ar
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="10: Setting local autoread\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoread', 0, 1, 'local']]
|
|
Karsten Hopp |
ab04bc |
+ :setlocal ar
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="11: Setting global autoread\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoread', 1, 0, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :setglobal invar
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="12: Setting option backspace through :let\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['backspace', '', 'eol,indent,start', 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :let &bs="eol,indent,start"
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="13: Setting option backspace through setbufvar()\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['backup', '', '1', 'local']]
|
|
Karsten Hopp |
ab04bc |
+ : "try twice, first time, shouldn't trigger because option name is invalid, second time, it should trigger
|
|
Karsten Hopp |
ab04bc |
+ :call setbufvar(1, '&l:bk', 1)
|
|
Karsten Hopp |
ab04bc |
+ : "should trigger, use correct option name
|
|
Karsten Hopp |
ab04bc |
+ :call setbufvar(1, '&backup', 1)
|
|
Karsten Hopp |
ab04bc |
+ :" Write register now, because next test shouldn't output anything.
|
|
Karsten Hopp |
ab04bc |
+ :$put r
|
|
Karsten Hopp |
ab04bc |
+ :let @r=''
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="\n14: Setting key option, shouldn't trigger\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['key', 'invalid', 'invalid1', 'invalid']]
|
|
Karsten Hopp |
ab04bc |
+ :setlocal key=blah
|
|
Karsten Hopp |
ab04bc |
+ :setlocal key=
|
|
Karsten Hopp |
ab04bc |
+ :$put =g:testcase
|
|
Karsten Hopp |
ab04bc |
+ :%w! test.out
|
|
Karsten Hopp |
ab04bc |
+ :qa!
|
|
Karsten Hopp |
ab04bc |
+ ENDTEST
|
|
Karsten Hopp |
ab04bc |
+ dummy text
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/testdir/test_autocmd_option.ok 2015-07-17 17:13:44.777224608 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/testdir/test_autocmd_option.ok 2015-07-17 14:58:39.362642959 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 0 ****
|
|
Karsten Hopp |
ab04bc |
--- 1,131 ----
|
|
Karsten Hopp |
ab04bc |
+ Test for option autocommand
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ STARTTEST
|
|
Karsten Hopp |
ab04bc |
+ :so small.vim
|
|
Karsten Hopp |
ab04bc |
+ :if !has("eval") || !has("autocmd") | e! test.ok | w! test.out | qa! | endif
|
|
Karsten Hopp |
ab04bc |
+ :fu! AutoCommand(match)
|
|
Karsten Hopp |
ab04bc |
+ : let c=g:testcase
|
|
Karsten Hopp |
ab04bc |
+ : let item=remove(g:options, 0)
|
|
Karsten Hopp |
ab04bc |
+ : let c.=printf("Expected: Name: <%s>, Oldval: <%s>, NewVal: <%s>, Scope: <%s>\n", item[0], item[1], item[2], item[3])
|
|
Karsten Hopp |
ab04bc |
+ : let c.=printf("Autocmd Option: <%s>,", a:match)
|
|
Karsten Hopp |
ab04bc |
+ : let c.=printf(" OldVal: <%s>,", v:option_old)
|
|
Karsten Hopp |
ab04bc |
+ : let c.=printf(" NewVal: <%s>,", v:option_new)
|
|
Karsten Hopp |
ab04bc |
+ : let c.=printf(" Scope: <%s>\n", v:option_type)
|
|
Karsten Hopp |
ab04bc |
+ : call setreg('r', printf("%s\n%s", getreg('r'), c))
|
|
Karsten Hopp |
ab04bc |
+ :endfu
|
|
Karsten Hopp |
ab04bc |
+ :au OptionSet * :call AutoCommand(expand("<amatch>"))
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="1: Setting number option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['number', 0, 1, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :set nu
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="2: Setting local number option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['number', 1, 0, 'local']]
|
|
Karsten Hopp |
ab04bc |
+ :setlocal nonu
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="3: Setting global number option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['number', 1, 0, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :setglobal nonu
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="4: Setting local autoindent option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoindent', 0, 1, 'local']]
|
|
Karsten Hopp |
ab04bc |
+ :setlocal ai
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="5: Setting global autoindent option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoindent', 0, 1, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :setglobal ai
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="6: Setting global autoindent option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoindent', 1, 0, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :set ai!
|
|
Karsten Hopp |
ab04bc |
+ : Should not print anything, use :noa
|
|
Karsten Hopp |
ab04bc |
+ :noa :set nonu
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="7: Setting several global list and number option\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['list', 0, 1, 'global'], ['number', 0, 1, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :set list nu
|
|
Karsten Hopp |
ab04bc |
+ :noa set nolist nonu
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="8: Setting global acd\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autochdir', 0, 1, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :setlocal acd
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="9: Setting global autoread\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoread', 0, 1, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :set ar
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="10: Setting local autoread\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoread', 0, 1, 'local']]
|
|
Karsten Hopp |
ab04bc |
+ :setlocal ar
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="11: Setting global autoread\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['autoread', 1, 0, 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :setglobal invar
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="12: Setting option backspace through :let\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['backspace', '', 'eol,indent,start', 'global']]
|
|
Karsten Hopp |
ab04bc |
+ :let &bs="eol,indent,start"
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="13: Setting option backspace through setbufvar()\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['backup', '', '1', 'local']]
|
|
Karsten Hopp |
ab04bc |
+ : "try twice, first time, shouldn't trigger because option name is invalid, second time, it should trigger
|
|
Karsten Hopp |
ab04bc |
+ :call setbufvar(1, '&l:bk', 1)
|
|
Karsten Hopp |
ab04bc |
+ : "should trigger, use correct option name
|
|
Karsten Hopp |
ab04bc |
+ :call setbufvar(1, '&backup', 1)
|
|
Karsten Hopp |
ab04bc |
+ :" Write register now, because next test shouldn't output anything.
|
|
Karsten Hopp |
ab04bc |
+ :$put r
|
|
Karsten Hopp |
ab04bc |
+ :let @r=''
|
|
Karsten Hopp |
ab04bc |
+ :let g:testcase="\n14: Setting key option, shouldn't trigger\n"
|
|
Karsten Hopp |
ab04bc |
+ :let g:options=[['key', 'invalid', 'invalid1', 'invalid']]
|
|
Karsten Hopp |
ab04bc |
+ :setlocal key=blah
|
|
Karsten Hopp |
ab04bc |
+ :setlocal key=
|
|
Karsten Hopp |
ab04bc |
+ :$put =g:testcase
|
|
Karsten Hopp |
ab04bc |
+ :%w! test.out
|
|
Karsten Hopp |
ab04bc |
+ :qa!
|
|
Karsten Hopp |
ab04bc |
+ ENDTEST
|
|
Karsten Hopp |
ab04bc |
+ dummy text
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 1: Setting number option
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <number>, Oldval: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <number>, OldVal: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 2: Setting local number option
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <number>, Oldval: <1>, NewVal: <0>, Scope: <local>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <number>, OldVal: <1>, NewVal: <0>, Scope: <local>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 3: Setting global number option
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <number>, Oldval: <1>, NewVal: <0>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <number>, OldVal: <1>, NewVal: <0>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 4: Setting local autoindent option
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <autoindent>, Oldval: <0>, NewVal: <1>, Scope: <local>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <autoindent>, OldVal: <0>, NewVal: <1>, Scope: <local>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 5: Setting global autoindent option
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <autoindent>, Oldval: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <autoindent>, OldVal: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 6: Setting global autoindent option
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <autoindent>, Oldval: <1>, NewVal: <0>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <autoindent>, OldVal: <1>, NewVal: <0>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 7: Setting several global list and number option
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <list>, Oldval: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <list>, OldVal: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 7: Setting several global list and number option
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <number>, Oldval: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <number>, OldVal: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 8: Setting global acd
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <autochdir>, Oldval: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <autochdir>, OldVal: <0>, NewVal: <1>, Scope: <local>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 9: Setting global autoread
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <autoread>, Oldval: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <autoread>, OldVal: <0>, NewVal: <1>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 10: Setting local autoread
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <autoread>, Oldval: <0>, NewVal: <1>, Scope: <local>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <autoread>, OldVal: <1>, NewVal: <1>, Scope: <local>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 11: Setting global autoread
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <autoread>, Oldval: <1>, NewVal: <0>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <autoread>, OldVal: <1>, NewVal: <0>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 12: Setting option backspace through :let
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <backspace>, Oldval: <>, NewVal: <eol,indent,start>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <backspace>, OldVal: <>, NewVal: <eol,indent,start>, Scope: <global>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 13: Setting option backspace through setbufvar()
|
|
Karsten Hopp |
ab04bc |
+ Expected: Name: <backup>, Oldval: <>, NewVal: <1>, Scope: <local>
|
|
Karsten Hopp |
ab04bc |
+ Autocmd Option: <backup>, OldVal: <0>, NewVal: <1>, Scope: <local>
|
|
Karsten Hopp |
ab04bc |
+
|
|
Karsten Hopp |
ab04bc |
+ 14: Setting key option, shouldn't trigger
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/vim.h 2015-07-10 17:56:18.219777154 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/vim.h 2015-07-17 15:01:08.737218443 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 1335,1340 ****
|
|
Karsten Hopp |
ab04bc |
--- 1335,1341 ----
|
|
Karsten Hopp |
ab04bc |
EVENT_TEXTCHANGED, /* text was modified */
|
|
Karsten Hopp |
ab04bc |
EVENT_TEXTCHANGEDI, /* text was modified in Insert mode*/
|
|
Karsten Hopp |
ab04bc |
EVENT_CMDUNDEFINED, /* command undefined */
|
|
Karsten Hopp |
ab04bc |
+ EVENT_OPTIONSET, /* option was set */
|
|
Karsten Hopp |
ab04bc |
NUM_EVENTS /* MUST be the last one */
|
|
Karsten Hopp |
ab04bc |
};
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 1898,1904 ****
|
|
Karsten Hopp |
ab04bc |
#define VV_WINDOWID 56
|
|
Karsten Hopp |
ab04bc |
#define VV_PROGPATH 57
|
|
Karsten Hopp |
ab04bc |
#define VV_COMPLETED_ITEM 58
|
|
Karsten Hopp |
ab04bc |
! #define VV_LEN 59 /* number of v: vars */
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
#ifdef FEAT_CLIPBOARD
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
--- 1899,1908 ----
|
|
Karsten Hopp |
ab04bc |
#define VV_WINDOWID 56
|
|
Karsten Hopp |
ab04bc |
#define VV_PROGPATH 57
|
|
Karsten Hopp |
ab04bc |
#define VV_COMPLETED_ITEM 58
|
|
Karsten Hopp |
ab04bc |
! #define VV_OPTION_NEW 59
|
|
Karsten Hopp |
ab04bc |
! #define VV_OPTION_OLD 60
|
|
Karsten Hopp |
ab04bc |
! #define VV_OPTION_TYPE 61
|
|
Karsten Hopp |
ab04bc |
! #define VV_LEN 62 /* number of v: vars */
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
#ifdef FEAT_CLIPBOARD
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
*** ../vim-7.4.785/src/version.c 2015-07-17 14:16:49.858596644 +0200
|
|
Karsten Hopp |
ab04bc |
--- src/version.c 2015-07-17 17:09:30.819636167 +0200
|
|
Karsten Hopp |
ab04bc |
***************
|
|
Karsten Hopp |
ab04bc |
*** 743,744 ****
|
|
Karsten Hopp |
ab04bc |
--- 743,746 ----
|
|
Karsten Hopp |
ab04bc |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
ab04bc |
+ /**/
|
|
Karsten Hopp |
ab04bc |
+ 786,
|
|
Karsten Hopp |
ab04bc |
/**/
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
--
|
|
Karsten Hopp |
ab04bc |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
ab04bc |
231. You sprinkle Carpet Fresh on the rugs and put your vacuum cleaner
|
|
Karsten Hopp |
ab04bc |
in the front doorway permanently so it always looks like you are
|
|
Karsten Hopp |
ab04bc |
actually attempting to do something about that mess that has amassed
|
|
Karsten Hopp |
ab04bc |
since you discovered the Internet.
|
|
Karsten Hopp |
ab04bc |
|
|
Karsten Hopp |
ab04bc |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
ab04bc |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
ab04bc |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
ab04bc |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|