From b52073ac119b8243a07dc67c15bf80cb5b8b0be4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Mar 2010 20:02:06 +0100 Subject: Updated runtime and language files. --- runtime/autoload/netrw.vim | 2 +- runtime/autoload/pythoncomplete.vim | 96 +++++++++++++++++++++++-------------- runtime/doc/eval.txt | 2 +- runtime/doc/insert.txt | 3 +- runtime/doc/todo.txt | 36 ++++++-------- runtime/syntax/mib.vim | 54 +++++++-------------- 6 files changed, 96 insertions(+), 97 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index dff8afd85..c1b178d19 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -2893,7 +2893,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let wlastline = line('w$') let lastline = line('$') " call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline) - if mouse_lnum == wlastline + 1 + if mouse_lnum == wlastline + 1 || v:mouse_win != winnr() " call Decho("appears to be a status bar leftmouse click") " appears to be a status bar leftmouse click return diff --git a/runtime/autoload/pythoncomplete.vim b/runtime/autoload/pythoncomplete.vim index 2f52f97e2..57add71cb 100644 --- a/runtime/autoload/pythoncomplete.vim +++ b/runtime/autoload/pythoncomplete.vim @@ -1,17 +1,28 @@ "pythoncomplete.vim - Omni Completion for python " Maintainer: Aaron Griffin -" Version: 0.7 -" Last Updated: 19 Oct 2006 +" Version: 0.9 +" Last Updated: 18 Jun 2009 " " Changes " TODO: -" User defined docstrings aren't handled right... " 'info' item output can use some formatting work " Add an "unsafe eval" mode, to allow for return type evaluation " Complete basic syntax along with import statements " i.e. "import url" " Continue parsing on invalid line?? " +" v 0.9 +" * Fixed docstring parsing for classes and functions +" * Fixed parsing of *args and **kwargs type arguments +" * Better function param parsing to handle things like tuples and +" lambda defaults args +" +" v 0.8 +" * Fixed an issue where the FIRST assignment was always used instead of +" using a subsequent assignment for a variable +" * Fixed a scoping issue when working inside a parameterless function +" +" " v 0.7 " * Fixed function list sorting (_ and __ at the bottom) " * Removed newline removal from docs. It appears vim handles these better in @@ -63,7 +74,7 @@ function! pythoncomplete#Complete(findstart, base) while idx > 0 let idx -= 1 let c = line[idx] - if c =~ '\w' || c =~ '\.' || c == '(' + if c =~ '\w' || c =~ '\.' let cword = c . cword continue elseif strlen(cword) > 0 || idx == 0 @@ -206,7 +217,7 @@ class Completer(object): if len(stmt) > 0 and stmt[-1] == '(': result = eval(_sanitize(stmt[:-1]), self.compldict) doc = result.__doc__ - if doc == None: doc = '' + if doc is None: doc = '' args = self.get_arguments(result) return [{'word':self._cleanstr(args),'info':self._cleanstr(doc)}] elif ridx == -1: @@ -223,18 +234,18 @@ class Completer(object): try: maindoc = result.__doc__ except: maindoc = ' ' - if maindoc == None: maindoc = ' ' + if maindoc is None: maindoc = ' ' for m in all: if m == "_PyCmplNoType": continue #this is internal try: dbg('possible completion: %s' % m) if m.find(match) == 0: - if result == None: inst = all[m] + if result is None: inst = all[m] else: inst = getattr(result,m) try: doc = inst.__doc__ except: doc = maindoc typestr = str(inst) - if doc == None or doc == '': doc = maindoc + if doc is None or doc == '': doc = maindoc wrd = m[len(match):] c = {'word':wrd, 'abbr':m, 'info':self._cleanstr(doc)} @@ -260,9 +271,9 @@ class Completer(object): return [] class Scope(object): - def __init__(self,name,indent): + def __init__(self,name,indent,docstr=''): self.subscopes = [] - self.docstr = '' + self.docstr = docstr self.locals = [] self.parent = None self.name = name @@ -281,29 +292,28 @@ class Scope(object): while d.find(' ') > -1: d = d.replace(' ',' ') while d[0] in '"\'\t ': d = d[1:] while d[-1] in '"\'\t ': d = d[:-1] + dbg("Scope(%s)::docstr = %s" % (self,d)) self.docstr = d def local(self,loc): - if not self._hasvaralready(loc): - self.locals.append(loc) + self._checkexisting(loc) + self.locals.append(loc) def copy_decl(self,indent=0): """ Copy a scope's declaration only, at the specified indent level - not local variables """ - return Scope(self.name,indent) + return Scope(self.name,indent,self.docstr) - def _hasvaralready(self,test): + def _checkexisting(self,test): "Convienance function... keep out duplicates" if test.find('=') > -1: var = test.split('=')[0].strip() for l in self.locals: if l.find('=') > -1 and var == l.split('=')[0].strip(): - return True - return False + self.locals.remove(l) def get_code(self): - # we need to start with this, to fix up broken completions - # hopefully this name is unique enough... - str = '"""'+self.docstr+'"""\n' + str = "" + if len(self.docstr) > 0: str += '"""'+self.docstr+'"""\n' for l in self.locals: if l.startswith('import'): str += l+'\n' str += 'class _PyCmplNoType:\n def __getattr__(self,name):\n return None\n' @@ -330,11 +340,11 @@ class Scope(object): return ' '*(self.indent+1) class Class(Scope): - def __init__(self, name, supers, indent): - Scope.__init__(self,name,indent) + def __init__(self, name, supers, indent, docstr=''): + Scope.__init__(self,name,indent, docstr) self.supers = supers def copy_decl(self,indent=0): - c = Class(self.name,self.supers,indent) + c = Class(self.name,self.supers,indent, self.docstr) for s in self.subscopes: c.add(s.copy_decl(indent+1)) return c @@ -351,11 +361,11 @@ class Class(Scope): class Function(Scope): - def __init__(self, name, params, indent): - Scope.__init__(self,name,indent) + def __init__(self, name, params, indent, docstr=''): + Scope.__init__(self,name,indent, docstr) self.params = params def copy_decl(self,indent=0): - return Function(self.name,self.params,indent) + return Function(self.name,self.params,indent, self.docstr) def get_code(self): str = "%sdef %s(%s):\n" % \ (self.currentindent(),self.name,','.join(self.params)) @@ -371,7 +381,7 @@ class PyParser: def _parsedotname(self,pre=None): #returns (dottedname, nexttoken) name = [] - if pre == None: + if pre is None: tokentype, token, indent = self.next() if tokentype != NAME and token != '*': return ('', token) @@ -405,17 +415,20 @@ class PyParser: while True: tokentype, token, indent = self.next() if token in (')', ',') and level == 1: - names.append(name) + if '=' not in name: name = name.replace(' ', '') + names.append(name.strip()) name = '' if token == '(': level += 1 + name += "(" elif token == ')': level -= 1 if level == 0: break + else: name += ")" elif token == ',' and level == 1: pass else: - name += str(token) + name += "%s " % str(token) return names def _parsefunction(self,indent): @@ -495,16 +508,26 @@ class PyParser: #Handle 'self' params if scp.parent != None and type(scp.parent) == Class: slice = 1 - p = scp.params[0] - i = p.find('=') - if i != -1: p = p[:i] newscope.local('%s = %s' % (scp.params[0],scp.parent.name)) for p in scp.params[slice:]: i = p.find('=') + if len(p) == 0: continue + pvar = '' + ptype = '' if i == -1: - newscope.local('%s = _PyCmplNoType()' % p) + pvar = p + ptype = '_PyCmplNoType()' else: - newscope.local('%s = %s' % (p[:i],_sanitize(p[i+1]))) + pvar = p[:i] + ptype = _sanitize(p[i+1:]) + if pvar.startswith('**'): + pvar = pvar[2:] + ptype = '{}' + elif pvar.startswith('*'): + pvar = pvar[1:] + ptype = '[]' + + newscope.local('%s = %s' % (pvar,ptype)) for s in scp.subscopes: ns = s.copy_decl(0) @@ -532,17 +555,19 @@ class PyParser: self.scope = self.scope.pop(indent) elif token == 'def': func = self._parsefunction(indent) - if func == None: + if func is None: print "function: syntax error..." continue + dbg("new scope: function") freshscope = True self.scope = self.scope.add(func) elif token == 'class': cls = self._parseclass(indent) - if cls == None: + if cls is None: print "class: syntax error..." continue freshscope = True + dbg("new scope: class") self.scope = self.scope.add(cls) elif token == 'import': @@ -569,6 +594,7 @@ class PyParser: name,token = self._parsedotname(token) if token == '=': stmt = self._parseassignment() + dbg("parseassignment: %s = %s" % (name, stmt)) if stmt != None: self.scope.local("%s = %s" % (name,stmt)) freshscope = False diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index e742bb14c..ec372d1db 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.2. Last change: 2010 Jan 19 +*eval.txt* For Vim version 7.2. Last change: 2010 Mar 10 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 61360a4aa..f3fb7581f 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.2. Last change: 2009 Jul 14 +*insert.txt* For Vim version 7.2. Last change: 2010 Mar 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -639,6 +639,7 @@ completion operation: > return "\" else return "\" + endif endfunction inoremap =CleverTab() diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index be1887469..8b0ce31bf 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.2. Last change: 2010 Mar 02 +*todo.txt* For Vim version 7.2. Last change: 2010 Mar 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -30,22 +30,22 @@ be worked on, but only if you sponsor Vim development. See |sponsor|. *known-bugs* -------------------- Known bugs and current work ----------------------- -Patch for access to freed memory. (Dominique Pelle, 2010 Feb 28) - -Update pythoncomplete. (Aaron Griffin, 2010 Feb 25) +":s" summary in :folddo is not correct. (Jean Johner, 2010 Feb 20) +Patch from Lech Lorens, 2010 Mar 13. -Patch for Visual Studio 2010. (George Reilly, 2010 Feb 26) -Test 69 breaks. +Vim tries to set the background or foreground color in a terminal to -1. +(Graywh) Appears to happen with ":hi Normal ctermbg=NONE". +Possible solution from Matt Wozniski, 2010 Mar 17. -With cmdline window open, can drag the status line above it, but not another -one. (Jean Johner, 2010 Feb 27) +Problem with cursor in the wrong column. (SungHyun Nam, 2010 Mar 11) +Additional info by Dominique Pelle. I often see pasted text (from Firefox, to Vim in xterm) appear twice. Also, Vim in xterm sometimes loses copy/paste ability (probably after running an external command). -In netrw, click on last status lines causes netrw to open the last entry in -the window. (Jean Johner, 2010 Feb 26) +Problem with transparent cmdline. Also: Terminal title is wrong with +non-ASCII character. (Lily White, 2010 Mar 7) iconv() doesn't fail on an illegal character, as documented. (Yongwei Wu, 2009 Nov 15, example Nov 26) Add argument to specify whether iconv() should fail @@ -55,8 +55,6 @@ Add local time at start of --startuptime output. Requires configure check for localtime(). Use format year-month-day hr:min:sec. -":s" summary in :folddo is not correct. (Jean Johner, 2010 Feb 20) - Shell not recognized properly if it ends in "csh -f". (James Vega, 2009 Nov 3) Find tail? Might have a / in argument. Find space? Might have space in path. @@ -67,6 +65,9 @@ Now with Mercurial repository (2010 Jan 2) Crash when assigning s: to variable, pointer becomes invalid later. (Yukihiro Nakadaira, 2009 Oct 12, confirmed by Dominique Pelle) +Test 69 breaks on MS-Windows, both 32 and 64 builds. (George Reilly, 2010 Feb +26) + Coverity: ask someone to create new user: Dominique. look into reported defects: http://scan.coverity.com/rung2.html @@ -97,16 +98,11 @@ http://blog.flameeyes.eu/2008/01/17/today-how-to-identify-unused-exported-functi In command line window ":close" doesn't work properly. (Tony Mechelynck, 2009 Jun 1) -Why does this give a #705 error: -let X = function('haslocaldir') -let X = function('getcwd') -Inserting "unlet X" helps. - When a:base in 'completefunc' starts with a number it's passed as a number, not a string. (Sean Ma) Need to add flag to call_func_retlist() to force a string value. -Reproducable crash in syntax HL. (George Reilly, Dominique Pelle, 2009 May 9) +Reproducible crash in syntax HL. (George Reilly, Dominique Pelle, 2009 May 9) Invalid read error in Farsi mode. (Dominique Pelle, 2009 Aug 2) @@ -143,9 +139,6 @@ Win32: Expanding 'path' runs into a maximum size limit. (bgold12, 2009 Nov 15) Setting 'tags' to "tagsdir/*" does not find "tagsdir/tags". (Steven K. Wong, 2009 Jul 18) -":e dir" with 'wildmode' set to "list" doesn't highlight directory names -with a space. (Alexandre Provencio, 2009 Jun 9) - Patch to add farsi handling to arabic.c (Ali Gholami Rudi, 2009 May 2) Added test, updates, June 23. @@ -1141,6 +1134,7 @@ Vim 7.3: Kocher (LGPL), close to original. Mohsin also has some ideas. Take four bytes and turn them into unsigned to avoid byte-order problems. Need to buffer up to 7 bytes to align on 8 byte boundaries. + Patch from Moshin, 2010 Mar 15. - ":{range}source": source the lines from the current file. You can already yank lines and use :@" to execute them. Most of do_source() would not be used, need a new function. diff --git a/runtime/syntax/mib.vim b/runtime/syntax/mib.vim index a29242d0f..2a8a73f61 100644 --- a/runtime/syntax/mib.vim +++ b/runtime/syntax/mib.vim @@ -1,22 +1,15 @@ " Vim syntax file -" Language: Vim syntax file for SNMPv1 and SNMPv2 MIB and SMI files -" Author: David Pascoe -" Written: Wed Jan 28 14:37:23 GMT--8:00 1998 -" Last Changed: Thu Feb 27 10:18:16 WST 2003 +" Language: Vim syntax file for SNMPv1 and SNMPv2 MIB and SMI files +" Maintainer: Martin Smat +" Original Author: David Pascoe +" Written: Wed Jan 28 14:37:23 GMT--8:00 1998 +" Last Changed: Mon Mar 15 2010 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif -if version >= 600 - setlocal iskeyword=@,48-57,_,128-167,224-235,-,:,= -else - set iskeyword=@,48-57,_,128-167,224-235,-,:,= -endif +setlocal iskeyword=@,48-57,_,128-167,224-235,-,:,= syn keyword mibImplicit ACCESS ANY AUGMENTS BEGIN BIT BITS BOOLEAN CHOICE syn keyword mibImplicit COMPONENTS CONTACT-INFO DEFINITIONS DEFVAL @@ -47,31 +40,16 @@ syn keyword mibEpilogue test-function-async next-function next-function-async syn keyword mibEpilogue leaf-name syn keyword mibEpilogue DEFAULT contained -syn match mibComment "\ *--.*$" -syn match mibNumber "\<['0-9a-fA-FhH]*\>" +syn match mibComment "\ *--.\{-}\(--\|$\)" +syn match mibNumber "\<['0-9a-fA-FhH]*\>" syn region mibDescription start="\"" end="\"" contains=DEFAULT -" Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_mib_syn_inits") - if version < 508 - let did_mib_syn_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - - HiLink mibImplicit Statement - HiLink mibComment Comment - HiLink mibConstants String - HiLink mibNumber Number - HiLink mibDescription Identifier - HiLink mibEpilogue SpecialChar - HiLink mibValue Structure - delcommand HiLink -endif +hi def link mibImplicit Statement +hi def link mibComment Comment +hi def link mibConstants String +hi def link mibNumber Number +hi def link mibDescription Identifier +hi def link mibEpilogue SpecialChar +hi def link mibValue Structure let b:current_syntax = "mib" - -" vim: ts=8 -- cgit v1.2.1