|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.152
|
|
|
22c937 |
Fcc: outbox
|
|
|
22c937 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
22c937 |
Mime-Version: 1.0
|
|
|
22c937 |
Content-Type: text/plain; charset=UTF-8
|
|
|
22c937 |
Content-Transfer-Encoding: 8bit
|
|
|
22c937 |
------------
|
|
|
22c937 |
|
|
|
22c937 |
Patch 7.4.152
|
|
|
22c937 |
Problem: Python: Cannot iterate over options.
|
|
|
22c937 |
Solution: Add options iterator. (ZyX)
|
|
|
22c937 |
Files: src/if_py_both.h, src/option.c, src/proto/option.pro,
|
|
|
22c937 |
src/testdir/test86.in, src/testdir/test86.ok,
|
|
|
22c937 |
src/testdir/test87.in, src/testdir/test87.ok, src/vim.h
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.151/src/if_py_both.h 2014-01-14 16:36:40.000000000 +0100
|
|
|
22c937 |
--- src/if_py_both.h 2014-01-14 16:51:30.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2949,2958 ****
|
|
|
22c937 |
typedef struct
|
|
|
22c937 |
{
|
|
|
22c937 |
PyObject_HEAD
|
|
|
22c937 |
! int opt_type;
|
|
|
22c937 |
! void *from;
|
|
|
22c937 |
! checkfun Check;
|
|
|
22c937 |
! PyObject *fromObj;
|
|
|
22c937 |
} OptionsObject;
|
|
|
22c937 |
|
|
|
22c937 |
static int
|
|
|
22c937 |
--- 2949,2958 ----
|
|
|
22c937 |
typedef struct
|
|
|
22c937 |
{
|
|
|
22c937 |
PyObject_HEAD
|
|
|
22c937 |
! int opt_type;
|
|
|
22c937 |
! void *from;
|
|
|
22c937 |
! checkfun Check;
|
|
|
22c937 |
! PyObject *fromObj;
|
|
|
22c937 |
} OptionsObject;
|
|
|
22c937 |
|
|
|
22c937 |
static int
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 3072,3077 ****
|
|
|
22c937 |
--- 3072,3140 ----
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
static int
|
|
|
22c937 |
+ OptionsContains(OptionsObject *self, PyObject *keyObject)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ char_u *key;
|
|
|
22c937 |
+ PyObject *todecref;
|
|
|
22c937 |
+
|
|
|
22c937 |
+ if (!(key = StringToChars(keyObject, &todecref)))
|
|
|
22c937 |
+ return -1;
|
|
|
22c937 |
+
|
|
|
22c937 |
+ if (*key == NUL)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ Py_XDECREF(todecref);
|
|
|
22c937 |
+ return 0;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ if (get_option_value_strict(key, NULL, NULL, self->opt_type, NULL))
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ Py_XDECREF(todecref);
|
|
|
22c937 |
+ return 1;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+ else
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ Py_XDECREF(todecref);
|
|
|
22c937 |
+ return 0;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ typedef struct
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ void *lastoption;
|
|
|
22c937 |
+ int opt_type;
|
|
|
22c937 |
+ } optiterinfo_T;
|
|
|
22c937 |
+
|
|
|
22c937 |
+ static PyObject *
|
|
|
22c937 |
+ OptionsIterNext(optiterinfo_T **oii)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ char_u *name;
|
|
|
22c937 |
+
|
|
|
22c937 |
+ if ((name = option_iter_next(&((*oii)->lastoption), (*oii)->opt_type)))
|
|
|
22c937 |
+ return PyString_FromString((char *)name);
|
|
|
22c937 |
+
|
|
|
22c937 |
+ return NULL;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ static PyObject *
|
|
|
22c937 |
+ OptionsIter(OptionsObject *self)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ optiterinfo_T *oii;
|
|
|
22c937 |
+
|
|
|
22c937 |
+ if (!(oii = PyMem_New(optiterinfo_T, 1)))
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ PyErr_NoMemory();
|
|
|
22c937 |
+ return NULL;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ oii->opt_type = self->opt_type;
|
|
|
22c937 |
+ oii->lastoption = NULL;
|
|
|
22c937 |
+
|
|
|
22c937 |
+ return IterNew(oii,
|
|
|
22c937 |
+ (destructorfun) PyMem_Free, (nextfun) OptionsIterNext,
|
|
|
22c937 |
+ NULL, NULL);
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ static int
|
|
|
22c937 |
set_option_value_err(char_u *key, int numval, char_u *stringval, int opt_flags)
|
|
|
22c937 |
{
|
|
|
22c937 |
char_u *errmsg;
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 3231,3236 ****
|
|
|
22c937 |
--- 3294,3312 ----
|
|
|
22c937 |
return ret;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
+ static PySequenceMethods OptionsAsSeq = {
|
|
|
22c937 |
+ 0, /* sq_length */
|
|
|
22c937 |
+ 0, /* sq_concat */
|
|
|
22c937 |
+ 0, /* sq_repeat */
|
|
|
22c937 |
+ 0, /* sq_item */
|
|
|
22c937 |
+ 0, /* sq_slice */
|
|
|
22c937 |
+ 0, /* sq_ass_item */
|
|
|
22c937 |
+ 0, /* sq_ass_slice */
|
|
|
22c937 |
+ (objobjproc) OptionsContains, /* sq_contains */
|
|
|
22c937 |
+ 0, /* sq_inplace_concat */
|
|
|
22c937 |
+ 0, /* sq_inplace_repeat */
|
|
|
22c937 |
+ };
|
|
|
22c937 |
+
|
|
|
22c937 |
static PyMappingMethods OptionsAsMapping = {
|
|
|
22c937 |
(lenfunc) NULL,
|
|
|
22c937 |
(binaryfunc) OptionsItem,
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 6121,6128 ****
|
|
|
22c937 |
--- 6197,6206 ----
|
|
|
22c937 |
vim_memset(&OptionsType, 0, sizeof(OptionsType));
|
|
|
22c937 |
OptionsType.tp_name = "vim.options";
|
|
|
22c937 |
OptionsType.tp_basicsize = sizeof(OptionsObject);
|
|
|
22c937 |
+ OptionsType.tp_as_sequence = &OptionsAsSeq;
|
|
|
22c937 |
OptionsType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC;
|
|
|
22c937 |
OptionsType.tp_doc = "object for manipulating options";
|
|
|
22c937 |
+ OptionsType.tp_iter = (getiterfunc)OptionsIter;
|
|
|
22c937 |
OptionsType.tp_as_mapping = &OptionsAsMapping;
|
|
|
22c937 |
OptionsType.tp_dealloc = (destructor)OptionsDestructor;
|
|
|
22c937 |
OptionsType.tp_traverse = (traverseproc)OptionsTraverse;
|
|
|
22c937 |
*** ../vim-7.4.151/src/option.c 2013-11-12 04:43:57.000000000 +0100
|
|
|
22c937 |
--- src/option.c 2014-01-14 16:50:52.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 8861,8867 ****
|
|
|
22c937 |
}
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
! #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3)
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Returns the option attributes and its value. Unlike the above function it
|
|
|
22c937 |
* will return either global value or local value of the option depending on
|
|
|
22c937 |
--- 8861,8867 ----
|
|
|
22c937 |
}
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
! #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO)
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Returns the option attributes and its value. Unlike the above function it
|
|
|
22c937 |
* will return either global value or local value of the option depending on
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 8874,8880 ****
|
|
|
22c937 |
* opt_type). Uses
|
|
|
22c937 |
*
|
|
|
22c937 |
* Returned flags:
|
|
|
22c937 |
! * 0 hidden or unknown option
|
|
|
22c937 |
* see SOPT_* in vim.h for other flags
|
|
|
22c937 |
*
|
|
|
22c937 |
* Possible opt_type values: see SREQ_* in vim.h
|
|
|
22c937 |
--- 8874,8881 ----
|
|
|
22c937 |
* opt_type). Uses
|
|
|
22c937 |
*
|
|
|
22c937 |
* Returned flags:
|
|
|
22c937 |
! * 0 hidden or unknown option, also option that does not have requested
|
|
|
22c937 |
! * type (see SREQ_* in vim.h)
|
|
|
22c937 |
* see SOPT_* in vim.h for other flags
|
|
|
22c937 |
*
|
|
|
22c937 |
* Possible opt_type values: see SREQ_* in vim.h
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 8997,9002 ****
|
|
|
22c937 |
--- 8998,9065 ----
|
|
|
22c937 |
|
|
|
22c937 |
return r;
|
|
|
22c937 |
}
|
|
|
22c937 |
+
|
|
|
22c937 |
+ /*
|
|
|
22c937 |
+ * Iterate over options. First argument is a pointer to a pointer to a structure
|
|
|
22c937 |
+ * inside options[] array, second is option type like in the above function.
|
|
|
22c937 |
+ *
|
|
|
22c937 |
+ * If first argument points to NULL it is assumed that iteration just started
|
|
|
22c937 |
+ * and caller needs the very first value.
|
|
|
22c937 |
+ * If first argument points to the end marker function returns NULL and sets
|
|
|
22c937 |
+ * first argument to NULL.
|
|
|
22c937 |
+ *
|
|
|
22c937 |
+ * Returns full option name for current option on each call.
|
|
|
22c937 |
+ */
|
|
|
22c937 |
+ char_u *
|
|
|
22c937 |
+ option_iter_next(option, opt_type)
|
|
|
22c937 |
+ void **option;
|
|
|
22c937 |
+ int opt_type;
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ struct vimoption *ret = NULL;
|
|
|
22c937 |
+ do
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ if (*option == NULL)
|
|
|
22c937 |
+ *option = (void *) options;
|
|
|
22c937 |
+ else if (((struct vimoption *) (*option))->fullname == NULL)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ *option = NULL;
|
|
|
22c937 |
+ return NULL;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+ else
|
|
|
22c937 |
+ *option = (void *) (((struct vimoption *) (*option)) + 1);
|
|
|
22c937 |
+
|
|
|
22c937 |
+ ret = ((struct vimoption *) (*option));
|
|
|
22c937 |
+
|
|
|
22c937 |
+ /* Hidden option */
|
|
|
22c937 |
+ if (ret->var == NULL)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ ret = NULL;
|
|
|
22c937 |
+ continue;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ switch (opt_type)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ case SREQ_GLOBAL:
|
|
|
22c937 |
+ if (!(ret->indir == PV_NONE || ret->indir & PV_BOTH))
|
|
|
22c937 |
+ ret = NULL;
|
|
|
22c937 |
+ break;
|
|
|
22c937 |
+ case SREQ_BUF:
|
|
|
22c937 |
+ if (!(ret->indir & PV_BUF))
|
|
|
22c937 |
+ ret = NULL;
|
|
|
22c937 |
+ break;
|
|
|
22c937 |
+ case SREQ_WIN:
|
|
|
22c937 |
+ if (!(ret->indir & PV_WIN))
|
|
|
22c937 |
+ ret = NULL;
|
|
|
22c937 |
+ break;
|
|
|
22c937 |
+ default:
|
|
|
22c937 |
+ EMSG2(_(e_intern2), "option_iter_next()");
|
|
|
22c937 |
+ return NULL;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+ while (ret == NULL);
|
|
|
22c937 |
+
|
|
|
22c937 |
+ return (char_u *)ret->fullname;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
*** ../vim-7.4.151/src/proto/option.pro 2013-11-05 07:12:59.000000000 +0100
|
|
|
22c937 |
--- src/proto/option.pro 2014-01-14 16:51:41.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 23,28 ****
|
|
|
22c937 |
--- 23,29 ----
|
|
|
22c937 |
char_u *check_stl_option __ARGS((char_u *s));
|
|
|
22c937 |
int get_option_value __ARGS((char_u *name, long *numval, char_u **stringval, int opt_flags));
|
|
|
22c937 |
int get_option_value_strict __ARGS((char_u *name, long *numval, char_u **stringval, int opt_type, void *from));
|
|
|
22c937 |
+ char_u *option_iter_next __ARGS((void **option, int opt_type));
|
|
|
22c937 |
char_u *set_option_value __ARGS((char_u *name, long number, char_u *string, int opt_flags));
|
|
|
22c937 |
char_u *get_term_code __ARGS((char_u *tname));
|
|
|
22c937 |
char_u *get_highlight_default __ARGS((void));
|
|
|
22c937 |
*** ../vim-7.4.151/src/testdir/test86.in 2014-01-14 16:36:40.000000000 +0100
|
|
|
22c937 |
--- src/testdir/test86.in 2014-01-14 16:49:10.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 506,511 ****
|
|
|
22c937 |
--- 506,516 ----
|
|
|
22c937 |
:py bopts1=vim.buffers[vim.bindeval("g:bufs")[2]].options
|
|
|
22c937 |
:py bopts2=vim.buffers[vim.bindeval("g:bufs")[1]].options
|
|
|
22c937 |
:py bopts3=vim.buffers[vim.bindeval("g:bufs")[0]].options
|
|
|
22c937 |
+ :$put ='wopts iters equal: '.pyeval('list(wopts1) == list(wopts2)')
|
|
|
22c937 |
+ :$put ='bopts iters equal: '.pyeval('list(bopts1) == list(bopts2)')
|
|
|
22c937 |
+ :py gset=set(iter(gopts1))
|
|
|
22c937 |
+ :py wset=set(iter(wopts1))
|
|
|
22c937 |
+ :py bset=set(iter(bopts1))
|
|
|
22c937 |
:set path=.,..,,
|
|
|
22c937 |
:let lst=[]
|
|
|
22c937 |
:let lst+=[['paste', 1, 0, 1, 2, 1, 1, 0 ]]
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 536,541 ****
|
|
|
22c937 |
--- 541,548 ----
|
|
|
22c937 |
: py oval3=bool(oval3)
|
|
|
22c937 |
: endif
|
|
|
22c937 |
: put ='>>> '.oname
|
|
|
22c937 |
+ : $put =' g/w/b:'.pyeval('oname in gset').'/'.pyeval('oname in wset').'/'.pyeval('oname in bset')
|
|
|
22c937 |
+ : $put =' g/w/b (in):'.pyeval('oname in gopts1').'/'.pyeval('oname in wopts1').'/'.pyeval('oname in bopts1')
|
|
|
22c937 |
: for v in ['gopts1', 'wopts1', 'bopts1']
|
|
|
22c937 |
: try
|
|
|
22c937 |
: put =' p/'.v.': '.Ev('repr('.v.'['''.oname.'''])')
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1122,1127 ****
|
|
|
22c937 |
--- 1129,1141 ----
|
|
|
22c937 |
ee('import failing')
|
|
|
22c937 |
vim.options['rtp'] = old_rtp
|
|
|
22c937 |
del old_rtp
|
|
|
22c937 |
+ cb.append("> Options")
|
|
|
22c937 |
+ cb.append(">> OptionsItem")
|
|
|
22c937 |
+ ee('vim.options["abcQ"]')
|
|
|
22c937 |
+ ee('vim.options[""]')
|
|
|
22c937 |
+ stringtochars_test('vim.options[%s]')
|
|
|
22c937 |
+ cb.append(">> OptionsContains")
|
|
|
22c937 |
+ stringtochars_test('%s in vim.options')
|
|
|
22c937 |
cb.append("> Dictionary")
|
|
|
22c937 |
cb.append(">> DictionaryConstructor")
|
|
|
22c937 |
ee('vim.Dictionary("abcI")')
|
|
|
22c937 |
*** ../vim-7.4.151/src/testdir/test86.ok 2014-01-14 16:36:40.000000000 +0100
|
|
|
22c937 |
--- src/testdir/test86.ok 2014-01-14 16:49:10.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 112,118 ****
|
|
|
22c937 |
--- 112,122 ----
|
|
|
22c937 |
def
|
|
|
22c937 |
bar
|
|
|
22c937 |
jkl
|
|
|
22c937 |
+ wopts iters equal: 1
|
|
|
22c937 |
+ bopts iters equal: 1
|
|
|
22c937 |
>>> paste
|
|
|
22c937 |
+ g/w/b:1/0/0
|
|
|
22c937 |
+ g/w/b (in):1/0/0
|
|
|
22c937 |
p/gopts1: False
|
|
|
22c937 |
p/wopts1! KeyError
|
|
|
22c937 |
inv: 2! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 133,138 ****
|
|
|
22c937 |
--- 137,144 ----
|
|
|
22c937 |
W: 1:1 2:1 3:1 4:1
|
|
|
22c937 |
B: 1:1 2:1 3:1 4:1
|
|
|
22c937 |
>>> previewheight
|
|
|
22c937 |
+ g/w/b:1/0/0
|
|
|
22c937 |
+ g/w/b (in):1/0/0
|
|
|
22c937 |
p/gopts1: 12
|
|
|
22c937 |
inv: 'a'! TypeError
|
|
|
22c937 |
p/wopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 154,159 ****
|
|
|
22c937 |
--- 160,167 ----
|
|
|
22c937 |
W: 1:5 2:5 3:5 4:5
|
|
|
22c937 |
B: 1:5 2:5 3:5 4:5
|
|
|
22c937 |
>>> operatorfunc
|
|
|
22c937 |
+ g/w/b:1/0/0
|
|
|
22c937 |
+ g/w/b (in):1/0/0
|
|
|
22c937 |
p/gopts1: ''
|
|
|
22c937 |
inv: 2! TypeError
|
|
|
22c937 |
p/wopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 175,180 ****
|
|
|
22c937 |
--- 183,190 ----
|
|
|
22c937 |
W: 1:'A' 2:'A' 3:'A' 4:'A'
|
|
|
22c937 |
B: 1:'A' 2:'A' 3:'A' 4:'A'
|
|
|
22c937 |
>>> number
|
|
|
22c937 |
+ g/w/b:0/1/0
|
|
|
22c937 |
+ g/w/b (in):0/1/0
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 0! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 193,198 ****
|
|
|
22c937 |
--- 203,210 ----
|
|
|
22c937 |
W: 1:1 2:1 3:0 4:0
|
|
|
22c937 |
B: 1:1 2:1 3:0 4:0
|
|
|
22c937 |
>>> numberwidth
|
|
|
22c937 |
+ g/w/b:0/1/0
|
|
|
22c937 |
+ g/w/b (in):0/1/0
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: -100! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 212,217 ****
|
|
|
22c937 |
--- 224,231 ----
|
|
|
22c937 |
W: 1:3 2:5 3:2 4:8
|
|
|
22c937 |
B: 1:3 2:5 3:2 4:8
|
|
|
22c937 |
>>> colorcolumn
|
|
|
22c937 |
+ g/w/b:0/1/0
|
|
|
22c937 |
+ g/w/b (in):0/1/0
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 'abc4'! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 231,236 ****
|
|
|
22c937 |
--- 245,252 ----
|
|
|
22c937 |
W: 1:'+2' 2:'+3' 3:'+1' 4:''
|
|
|
22c937 |
B: 1:'+2' 2:'+3' 3:'+1' 4:''
|
|
|
22c937 |
>>> statusline
|
|
|
22c937 |
+ g/w/b:1/1/0
|
|
|
22c937 |
+ g/w/b (in):1/1/0
|
|
|
22c937 |
p/gopts1: ''
|
|
|
22c937 |
inv: 0! TypeError
|
|
|
22c937 |
p/wopts1: None
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 248,253 ****
|
|
|
22c937 |
--- 264,271 ----
|
|
|
22c937 |
W: 1:'2' 2:'1' 3:'1' 4:'1'
|
|
|
22c937 |
B: 1:'2' 2:'1' 3:'1' 4:'1'
|
|
|
22c937 |
>>> autoindent
|
|
|
22c937 |
+ g/w/b:0/0/1
|
|
|
22c937 |
+ g/w/b (in):0/0/1
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 2! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 266,271 ****
|
|
|
22c937 |
--- 284,291 ----
|
|
|
22c937 |
W: 1:0 2:1 3:0 4:1
|
|
|
22c937 |
B: 1:0 2:1 3:0 4:1
|
|
|
22c937 |
>>> shiftwidth
|
|
|
22c937 |
+ g/w/b:0/0/1
|
|
|
22c937 |
+ g/w/b (in):0/0/1
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 3! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 284,289 ****
|
|
|
22c937 |
--- 304,311 ----
|
|
|
22c937 |
W: 1:0 2:2 3:8 4:1
|
|
|
22c937 |
B: 1:0 2:2 3:8 4:1
|
|
|
22c937 |
>>> omnifunc
|
|
|
22c937 |
+ g/w/b:0/0/1
|
|
|
22c937 |
+ g/w/b (in):0/0/1
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 1! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 303,308 ****
|
|
|
22c937 |
--- 325,332 ----
|
|
|
22c937 |
W: 1:'A' 2:'B' 3:'' 4:'C'
|
|
|
22c937 |
B: 1:'A' 2:'B' 3:'' 4:'C'
|
|
|
22c937 |
>>> preserveindent
|
|
|
22c937 |
+ g/w/b:0/0/1
|
|
|
22c937 |
+ g/w/b (in):0/0/1
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 2! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 321,326 ****
|
|
|
22c937 |
--- 345,352 ----
|
|
|
22c937 |
W: 1:0 2:1 3:0 4:1
|
|
|
22c937 |
B: 1:0 2:1 3:0 4:1
|
|
|
22c937 |
>>> path
|
|
|
22c937 |
+ g/w/b:1/0/1
|
|
|
22c937 |
+ g/w/b (in):1/0/1
|
|
|
22c937 |
p/gopts1: '.,..,,'
|
|
|
22c937 |
inv: 0! TypeError
|
|
|
22c937 |
p/wopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 509,514 ****
|
|
|
22c937 |
--- 535,555 ----
|
|
|
22c937 |
import xxx_no_such_module_xxx:ImportError:('No module named xxx_no_such_module_xxx',)
|
|
|
22c937 |
import failing_import:ImportError:('No module named failing_import',)
|
|
|
22c937 |
import failing:NotImplementedError:()
|
|
|
22c937 |
+ > Options
|
|
|
22c937 |
+ >> OptionsItem
|
|
|
22c937 |
+ vim.options["abcQ"]:KeyError:('abcQ',)
|
|
|
22c937 |
+ vim.options[""]:ValueError:('empty keys are not allowed',)
|
|
|
22c937 |
+ >>> Testing StringToChars using vim.options[%s]
|
|
|
22c937 |
+ vim.options[1]:TypeError:('expected str() or unicode() instance, but got int',)
|
|
|
22c937 |
+ vim.options[u"\0"]:TypeError:('expected string without null bytes',)
|
|
|
22c937 |
+ vim.options["\0"]:TypeError:('expected string without null bytes',)
|
|
|
22c937 |
+ <<< Finished
|
|
|
22c937 |
+ >> OptionsContains
|
|
|
22c937 |
+ >>> Testing StringToChars using %s in vim.options
|
|
|
22c937 |
+ 1 in vim.options:TypeError:('expected str() or unicode() instance, but got int',)
|
|
|
22c937 |
+ u"\0" in vim.options:TypeError:('expected string without null bytes',)
|
|
|
22c937 |
+ "\0" in vim.options:TypeError:('expected string without null bytes',)
|
|
|
22c937 |
+ <<< Finished
|
|
|
22c937 |
> Dictionary
|
|
|
22c937 |
>> DictionaryConstructor
|
|
|
22c937 |
vim.Dictionary("abcI"):ValueError:('expected sequence element of size 2, but got sequence of size 1',)
|
|
|
22c937 |
*** ../vim-7.4.151/src/testdir/test87.in 2014-01-14 16:36:40.000000000 +0100
|
|
|
22c937 |
--- src/testdir/test87.in 2014-01-14 16:49:10.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 503,508 ****
|
|
|
22c937 |
--- 503,513 ----
|
|
|
22c937 |
:py3 bopts1=vim.buffers[vim.bindeval("g:bufs")[2]].options
|
|
|
22c937 |
:py3 bopts2=vim.buffers[vim.bindeval("g:bufs")[1]].options
|
|
|
22c937 |
:py3 bopts3=vim.buffers[vim.bindeval("g:bufs")[0]].options
|
|
|
22c937 |
+ :$put ='wopts iters equal: '.py3eval('list(wopts1) == list(wopts2)')
|
|
|
22c937 |
+ :$put ='bopts iters equal: '.py3eval('list(bopts1) == list(bopts2)')
|
|
|
22c937 |
+ :py3 gset=set(iter(gopts1))
|
|
|
22c937 |
+ :py3 wset=set(iter(wopts1))
|
|
|
22c937 |
+ :py3 bset=set(iter(bopts1))
|
|
|
22c937 |
:set path=.,..,,
|
|
|
22c937 |
:let lst=[]
|
|
|
22c937 |
:let lst+=[['paste', 1, 0, 1, 2, 1, 1, 0 ]]
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 533,538 ****
|
|
|
22c937 |
--- 538,545 ----
|
|
|
22c937 |
: py3 oval3=bool(oval3)
|
|
|
22c937 |
: endif
|
|
|
22c937 |
: put ='>>> '.oname
|
|
|
22c937 |
+ : $put =' g/w/b:'.py3eval('oname in gset').'/'.py3eval('oname in wset').'/'.py3eval('oname in bset')
|
|
|
22c937 |
+ : $put =' g/w/b (in):'.py3eval('oname in gopts1').'/'.py3eval('oname in wopts1').'/'.py3eval('oname in bopts1')
|
|
|
22c937 |
: for v in ['gopts1', 'wopts1', 'bopts1']
|
|
|
22c937 |
: try
|
|
|
22c937 |
: put =' p/'.v.': '.Ev('repr('.v.'['''.oname.'''])')
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1099,1104 ****
|
|
|
22c937 |
--- 1106,1118 ----
|
|
|
22c937 |
ee('import failing')
|
|
|
22c937 |
vim.options['rtp'] = old_rtp
|
|
|
22c937 |
del old_rtp
|
|
|
22c937 |
+ cb.append("> Options")
|
|
|
22c937 |
+ cb.append(">> OptionsItem")
|
|
|
22c937 |
+ ee('vim.options["abcQ"]')
|
|
|
22c937 |
+ ee('vim.options[""]')
|
|
|
22c937 |
+ stringtochars_test('vim.options[%s]')
|
|
|
22c937 |
+ cb.append(">> OptionsContains")
|
|
|
22c937 |
+ stringtochars_test('%s in vim.options')
|
|
|
22c937 |
cb.append("> Dictionary")
|
|
|
22c937 |
cb.append(">> DictionaryConstructor")
|
|
|
22c937 |
ee('vim.Dictionary("abcI")')
|
|
|
22c937 |
*** ../vim-7.4.151/src/testdir/test87.ok 2014-01-14 16:36:40.000000000 +0100
|
|
|
22c937 |
--- src/testdir/test87.ok 2014-01-14 16:49:10.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 112,118 ****
|
|
|
22c937 |
--- 112,122 ----
|
|
|
22c937 |
def
|
|
|
22c937 |
bar
|
|
|
22c937 |
jkl
|
|
|
22c937 |
+ wopts iters equal: 1
|
|
|
22c937 |
+ bopts iters equal: 1
|
|
|
22c937 |
>>> paste
|
|
|
22c937 |
+ g/w/b:1/0/0
|
|
|
22c937 |
+ g/w/b (in):1/0/0
|
|
|
22c937 |
p/gopts1: False
|
|
|
22c937 |
p/wopts1! KeyError
|
|
|
22c937 |
inv: 2! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 133,138 ****
|
|
|
22c937 |
--- 137,144 ----
|
|
|
22c937 |
W: 1:1 2:1 3:1 4:1
|
|
|
22c937 |
B: 1:1 2:1 3:1 4:1
|
|
|
22c937 |
>>> previewheight
|
|
|
22c937 |
+ g/w/b:1/0/0
|
|
|
22c937 |
+ g/w/b (in):1/0/0
|
|
|
22c937 |
p/gopts1: 12
|
|
|
22c937 |
inv: 'a'! TypeError
|
|
|
22c937 |
p/wopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 154,159 ****
|
|
|
22c937 |
--- 160,167 ----
|
|
|
22c937 |
W: 1:5 2:5 3:5 4:5
|
|
|
22c937 |
B: 1:5 2:5 3:5 4:5
|
|
|
22c937 |
>>> operatorfunc
|
|
|
22c937 |
+ g/w/b:1/0/0
|
|
|
22c937 |
+ g/w/b (in):1/0/0
|
|
|
22c937 |
p/gopts1: b''
|
|
|
22c937 |
inv: 2! TypeError
|
|
|
22c937 |
p/wopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 175,180 ****
|
|
|
22c937 |
--- 183,190 ----
|
|
|
22c937 |
W: 1:'A' 2:'A' 3:'A' 4:'A'
|
|
|
22c937 |
B: 1:'A' 2:'A' 3:'A' 4:'A'
|
|
|
22c937 |
>>> number
|
|
|
22c937 |
+ g/w/b:0/1/0
|
|
|
22c937 |
+ g/w/b (in):0/1/0
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 0! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 193,198 ****
|
|
|
22c937 |
--- 203,210 ----
|
|
|
22c937 |
W: 1:1 2:1 3:0 4:0
|
|
|
22c937 |
B: 1:1 2:1 3:0 4:0
|
|
|
22c937 |
>>> numberwidth
|
|
|
22c937 |
+ g/w/b:0/1/0
|
|
|
22c937 |
+ g/w/b (in):0/1/0
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: -100! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 212,217 ****
|
|
|
22c937 |
--- 224,231 ----
|
|
|
22c937 |
W: 1:3 2:5 3:2 4:8
|
|
|
22c937 |
B: 1:3 2:5 3:2 4:8
|
|
|
22c937 |
>>> colorcolumn
|
|
|
22c937 |
+ g/w/b:0/1/0
|
|
|
22c937 |
+ g/w/b (in):0/1/0
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 'abc4'! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 231,236 ****
|
|
|
22c937 |
--- 245,252 ----
|
|
|
22c937 |
W: 1:'+2' 2:'+3' 3:'+1' 4:''
|
|
|
22c937 |
B: 1:'+2' 2:'+3' 3:'+1' 4:''
|
|
|
22c937 |
>>> statusline
|
|
|
22c937 |
+ g/w/b:1/1/0
|
|
|
22c937 |
+ g/w/b (in):1/1/0
|
|
|
22c937 |
p/gopts1: b''
|
|
|
22c937 |
inv: 0! TypeError
|
|
|
22c937 |
p/wopts1: None
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 248,253 ****
|
|
|
22c937 |
--- 264,271 ----
|
|
|
22c937 |
W: 1:'2' 2:'1' 3:'1' 4:'1'
|
|
|
22c937 |
B: 1:'2' 2:'1' 3:'1' 4:'1'
|
|
|
22c937 |
>>> autoindent
|
|
|
22c937 |
+ g/w/b:0/0/1
|
|
|
22c937 |
+ g/w/b (in):0/0/1
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 2! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 266,271 ****
|
|
|
22c937 |
--- 284,291 ----
|
|
|
22c937 |
W: 1:0 2:1 3:0 4:1
|
|
|
22c937 |
B: 1:0 2:1 3:0 4:1
|
|
|
22c937 |
>>> shiftwidth
|
|
|
22c937 |
+ g/w/b:0/0/1
|
|
|
22c937 |
+ g/w/b (in):0/0/1
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 3! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 284,289 ****
|
|
|
22c937 |
--- 304,311 ----
|
|
|
22c937 |
W: 1:0 2:2 3:8 4:1
|
|
|
22c937 |
B: 1:0 2:2 3:8 4:1
|
|
|
22c937 |
>>> omnifunc
|
|
|
22c937 |
+ g/w/b:0/0/1
|
|
|
22c937 |
+ g/w/b (in):0/0/1
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 1! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 303,308 ****
|
|
|
22c937 |
--- 325,332 ----
|
|
|
22c937 |
W: 1:'A' 2:'B' 3:'' 4:'C'
|
|
|
22c937 |
B: 1:'A' 2:'B' 3:'' 4:'C'
|
|
|
22c937 |
>>> preserveindent
|
|
|
22c937 |
+ g/w/b:0/0/1
|
|
|
22c937 |
+ g/w/b (in):0/0/1
|
|
|
22c937 |
p/gopts1! KeyError
|
|
|
22c937 |
inv: 2! KeyError
|
|
|
22c937 |
gopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 321,326 ****
|
|
|
22c937 |
--- 345,352 ----
|
|
|
22c937 |
W: 1:0 2:1 3:0 4:1
|
|
|
22c937 |
B: 1:0 2:1 3:0 4:1
|
|
|
22c937 |
>>> path
|
|
|
22c937 |
+ g/w/b:1/0/1
|
|
|
22c937 |
+ g/w/b (in):1/0/1
|
|
|
22c937 |
p/gopts1: b'.,..,,'
|
|
|
22c937 |
inv: 0! TypeError
|
|
|
22c937 |
p/wopts1! KeyError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 509,514 ****
|
|
|
22c937 |
--- 535,555 ----
|
|
|
22c937 |
import xxx_no_such_module_xxx:(<class 'ImportError'>, ImportError('No module named xxx_no_such_module_xxx',))
|
|
|
22c937 |
import failing_import:(<class 'ImportError'>, ImportError('No module named failing_import',))
|
|
|
22c937 |
import failing:(<class 'NotImplementedError'>, NotImplementedError())
|
|
|
22c937 |
+ > Options
|
|
|
22c937 |
+ >> OptionsItem
|
|
|
22c937 |
+ vim.options["abcQ"]:(<class 'KeyError'>, KeyError('abcQ',))
|
|
|
22c937 |
+ vim.options[""]:(<class 'ValueError'>, ValueError('empty keys are not allowed',))
|
|
|
22c937 |
+ >>> Testing StringToChars using vim.options[%s]
|
|
|
22c937 |
+ vim.options[1]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
|
|
|
22c937 |
+ vim.options[b"\0"]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
|
|
|
22c937 |
+ vim.options["\0"]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
|
|
|
22c937 |
+ <<< Finished
|
|
|
22c937 |
+ >> OptionsContains
|
|
|
22c937 |
+ >>> Testing StringToChars using %s in vim.options
|
|
|
22c937 |
+ 1 in vim.options:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
|
|
|
22c937 |
+ b"\0" in vim.options:(<class 'TypeError'>, TypeError('expected bytes with no null',))
|
|
|
22c937 |
+ "\0" in vim.options:(<class 'TypeError'>, TypeError('expected bytes with no null',))
|
|
|
22c937 |
+ <<< Finished
|
|
|
22c937 |
> Dictionary
|
|
|
22c937 |
>> DictionaryConstructor
|
|
|
22c937 |
vim.Dictionary("abcI"):(<class 'ValueError'>, ValueError('expected sequence element of size 2, but got sequence of size 1',))
|
|
|
22c937 |
*** ../vim-7.4.151/src/vim.h 2013-11-09 03:31:45.000000000 +0100
|
|
|
22c937 |
--- src/vim.h 2014-01-14 16:49:10.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2249,2254 ****
|
|
|
22c937 |
--- 2249,2255 ----
|
|
|
22c937 |
#define SOPT_BUF 0x20 /* Option has buffer-local value */
|
|
|
22c937 |
#define SOPT_UNSET 0x40 /* Option does not have local value set */
|
|
|
22c937 |
|
|
|
22c937 |
+ /* Option types for various functions in option.c */
|
|
|
22c937 |
#define SREQ_GLOBAL 0 /* Request global option */
|
|
|
22c937 |
#define SREQ_WIN 1 /* Request window-local option */
|
|
|
22c937 |
#define SREQ_BUF 2 /* Request buffer-local option */
|
|
|
22c937 |
*** ../vim-7.4.151/src/version.c 2014-01-14 16:36:40.000000000 +0100
|
|
|
22c937 |
--- src/version.c 2014-01-14 16:43:58.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 740,741 ****
|
|
|
22c937 |
--- 740,743 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 152,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
hundred-and-one symptoms of being an internet addict:
|
|
|
22c937 |
160. You get in the elevator and double-click the button for the floor
|
|
|
22c937 |
you want.
|
|
|
22c937 |
|
|
|
22c937 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
22c937 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
22c937 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
22c937 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|