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