changeset 666:0137e7c3d31b v7.0196

updated for version 7.0196
author vimboss
date Fri, 10 Feb 2006 23:23:57 +0000
parents 21ab9abf0f08
children 9090f866cd57
files runtime/autoload/ccomplete.vim runtime/doc/todo.txt runtime/doc/version7.txt src/eval.c src/ex_cmds.h src/ui.c
diffstat 6 files changed, 69 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/autoload/ccomplete.vim
+++ b/runtime/autoload/ccomplete.vim
@@ -1,7 +1,7 @@
 " Vim completion script
 " Language:	C
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last Change:	2006 Feb 06
+" Last Change:	2006 Feb 10
 
 
 " This function is used for the 'omnifunc' option.
@@ -213,9 +213,8 @@ endfunction
 " If it is a variable we may add "." or "->".  Don't do it for other types,
 " such as a typedef, by not including the info that s:GetAddition() uses.
 function! s:Tag2item(val)
-  let x = substitute(a:val['cmd'], '^/^', '', '')
-  let x = substitute(x, '$/$', '', '')
-  let x = substitute(x, a:val['name'], '@@', '')
+  let x = s:Tagcmd2extra(a:val['cmd'], a:val['name'], a:val['filename'])
+
   if has_key(a:val, "kind")
     if a:val["kind"] == 'v'
       return {'match': a:val['name'], 'tagline': "\t" . a:val['cmd'], 'dict': a:val, 'extra': x}
@@ -231,13 +230,37 @@ endfunction
 " "val['match']" is the matching item.
 " "val['tagline']" is the tagline in which the last part was found.
 function! s:Tagline2item(val, brackets)
-  let word = a:val['match'] . a:brackets . s:GetAddition(a:val['tagline'], a:val['match'], [a:val], a:brackets == '')
+  let line = a:val['tagline']
+  let word = a:val['match'] . a:brackets . s:GetAddition(line, a:val['match'], [a:val], a:brackets == '')
   if has_key(a:val, 'extra')
     return {'word': word, 'menu': a:val['extra']}
   endif
-  return {'word': word, 'menu': substitute(a:val['tagline'], word, '@@', '')}
+
+  " Isolate the command after the tag and filename.
+  let s = matchstr(line, '[^\t]*\t[^\t]*\t\zs\(/^.*$/\|[^\t]*\)\ze\(;"\t\|\t\|$\)')
+  if s != ''
+    return {'word': word, 'menu': s:Tagcmd2extra(s, a:val['match'], matchstr(line, '[^\t]*\t\zs[^\t]*\ze\t'))}
+  endif
+  return {'word': word}
 endfunction
 
+" Turn a command from a tag line to something that is useful in the menu
+function! s:Tagcmd2extra(cmd, name, fname)
+  if a:cmd =~ '^/^'
+    " The command is a search command, useful to see what it is.
+    let x = matchstr(a:cmd, '^/^\zs.*\ze$/')
+    let x = substitute(x, a:name, '@@', '')
+    let x = substitute(x, '\\\(.\)', '\1', 'g')
+    let x = x . ' - ' . a:fname
+  elseif a:cmd =~ '^\d*$'
+    " The command is a line number, the file name is more useful.
+    let x = a:fname . ' - ' . a:cmd
+  else
+    " Not recognized, use command and file name.
+    let x = a:cmd . ' - ' . a:fname
+  endif
+  return x
+endfunction
 
 " Find composing type in "lead" and match items[0] with it.
 " Repeat this recursively for items[1], if it's there.
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2006 Feb 09
+*todo.txt*      For Vim version 7.0aa.  Last change: 2006 Feb 10
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -32,23 +32,14 @@ be worked on, but only if you sponsor Vi
 
 Crash with X command server (Ciaran McCreesh).
 
-Add ":lcscope" to use location list instead of quickfix list.
-
 ccomplete / omnicomplete:
-When editing compl_leader <CR> should accept the current match.
-Somehow select another match without changing the compl_leader, so that you
-can use CTRL-L next?  Perhaps with <S-Up> and <S-Down>?
+- For C add tag "kind" field to each match?
 - Flickering because of syntax highlighting redrawing further lines.
-- Complete the longest common match instead of the first match?
-    Do this when "longest" is in 'completeopt'.
-    Pressing CTRL-N or CTRL-P will get the whole match, as before.
-    Need to postpone inserting anything until all matches have been found.
-    Then add a completion item with the longest common string (after what was
-    typed), if there is one.
-- For C add tag "kind" field to each match?
 - Finding out if an item has members (to add '.' or '->') requires a grep in
   the tags files, that is very slow.  Is there another solution?  At least
   stop at the first match.
+  Could build the list of items for each structure in memory.  Is that faster?
+  Not using too much memory?
 - When a typedef or struct is local to a file only use it in that file?
 - Special mappings for when the popup menu is visible?  Would allow for making
   a specific selection (e.g, methods vs variables).
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2006 Feb 09
+*version7.txt*  For Vim version 7.0aa.  Last change: 2006 Feb 10
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -457,13 +457,6 @@ Win32: The ":winpos" command now also wo
 |:caddbuffer|		Add errors from the current buffer to the quickfix
 			list.
 
-|:ltag|			Jump to a tag and add matching tags to a location list.
-|:lmake|		Like |:make| but use the location list.
-|:lgrep|		Like |:grep| but use the location list.
-|:lgrepadd|		Like |:grepadd| but use the location list.
-|:lvimgrep|		Like |:vimgrep| but use the location list.
-|:lvimgrepadd|		Like |:vimgrepadd| but use the location list.
-|:lhelpgrep|		Like |:helpgrep| but use the location list.
 |:lfile|		Like |:cfile| but use the location list.
 |:lgetfile|		Like |:cgetfile| but use the location list.
 |:laddfile|		Like |:caddfile| but use the location list.
@@ -474,7 +467,7 @@ Win32: The ":winpos" command now also wo
 |:ll|			Like |:cc| but use the location list.
 |:llist|		Like |:clist| but use the location list.
 |:lnext|		Like |:cnext| but use the location list.
-|:lprev|		Like |:cprev| but use the location list.
+|:lprevious|		Like |:cprevious| but use the location list.
 |:lNext|		Like |:cNext| but use the location list.
 |:lfirst|		Like |:cfirst| but use the location list.
 |:lrewind|		Like |:crewind| but use the location list.
@@ -487,6 +480,14 @@ Win32: The ":winpos" command now also wo
 |:lwindow|		Like |:cwindow| but use the location list.
 |:lopen|		Like |:copen| but use the location list.
 |:lclose|		Like |:cclose| but use the location list.
+|:lmake|		Like |:make| but use the location list.
+|:lgrep|		Like |:grep| but use the location list.
+|:lgrepadd|		Like |:grepadd| but use the location list.
+|:lvimgrep|		Like |:vimgrep| but use the location list.
+|:lvimgrepadd|		Like |:vimgrepadd| but use the location list.
+|:lhelpgrep|		Like |:helpgrep| but use the location list.
+|:lcscope|		Like |:cscope| but use the location list.
+|:ltag|			Jump to a tag and add matching tags to a location list.
 
 
 Ex command modifiers: ~
@@ -1682,4 +1683,7 @@ mapped.  Use ":normal!" instead of ":nor
 
 Crashed when expanding a file name argument in backticks.
 
+In some situations the menu and scrollbar didn't work, when the value contains
+a CSI byte. (Yukihiro Nakadaira)
+
  vim:tw=78:ts=8:ft=help:norl:
--- a/src/eval.c
+++ b/src/eval.c
@@ -15378,7 +15378,21 @@ var2fpos(varp, lnum)
 	    return NULL;
 	return pp;
     }
-    if (name[0] == '$')		/* last column or line */
+    if (name[0] == 'w' && lnum)
+    {
+	pos.col = 0;
+	if (name[1] == '0')		/* "w0": first visible line */
+	{
+	    pos.lnum = curwin->w_topline;
+	    return &pos;
+	}
+	else if (name[1] == '$')	/* "w$": last visible line */
+	{
+	    pos.lnum = curwin->w_botline - 1;
+	    return &pos;
+	}
+    }
+    else if (name[0] == '$')		/* last column or line */
     {
 	if (lnum)
 	{
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -497,6 +497,8 @@ EX(CMD_lchdir,		"lchdir",	ex_cd,
 			BANG|FILE1|TRLBAR|CMDWIN),
 EX(CMD_lclose,		"lclose",	ex_cclose,
 			RANGE|NOTADR|COUNT|TRLBAR),
+EX(CMD_lcscope,		"lcscope",	do_cscope,
+			EXTRA|NOTRLCOM|SBOXOK|XFILE),
 EX(CMD_left,		"left",		ex_align,
 			TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
 EX(CMD_leftabove,	"leftabove",	ex_wrongmodifier,
--- a/src/ui.c
+++ b/src/ui.c
@@ -1593,7 +1593,10 @@ set_input_buf(p)
 
 #if defined(FEAT_GUI) || defined(FEAT_MOUSE_GPM) \
 	|| defined(FEAT_XCLIPBOARD) || defined(VMS) \
-	|| defined(FEAT_SNIFF) || defined(FEAT_CLIENTSERVER) || defined(PROTO)
+	|| defined(FEAT_SNIFF) || defined(FEAT_CLIENTSERVER) \
+	|| (defined(FEAT_GUI) && (!defined(USE_ON_FLY_SCROLL) \
+		|| defined(FEAT_MENU))) \
+	|| defined(PROTO)
 /*
  * Add the given bytes to the input buffer
  * Special keys start with CSI.  A real CSI must have been translated to
@@ -1620,6 +1623,8 @@ add_to_input_buf(s, len)
 
 #if (defined(FEAT_XIM) && defined(FEAT_GUI_GTK)) \
 	|| (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) \
+	|| (defined(FEAT_GUI) && (!defined(USE_ON_FLY_SCROLL) \
+		|| defined(FEAT_MENU))) \
 	|| defined(PROTO)
 /*
  * Add "str[len]" to the input buffer while escaping CSI bytes.