• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Révision7e6d264ec0a270beb9692df71fedb210c1896640 (tree)
l'heure2005-09-06 07:14:46
Auteurvimboss
Commitervimboss

Message de Log

updated for version 7.0141

Change Summary

Modification

diff -r 35cde31bdcbd -r 7e6d264ec0a2 runtime/autoload/ccomplete.vim
--- a/runtime/autoload/ccomplete.vim Mon Sep 05 22:11:52 2005 +0000
+++ b/runtime/autoload/ccomplete.vim Mon Sep 05 22:14:46 2005 +0000
@@ -1,7 +1,7 @@
11 " Vim completion script
22 " Language: C
33 " Maintainer: Bram Moolenaar <Bram@vim.org>
4-" Last Change: 2005 Sep 01
4+" Last Change: 2005 Sep 05
55
66 function! ccomplete#Complete(findstart, base)
77 if a:findstart
@@ -21,12 +21,81 @@
2121 endif
2222
2323 " return list of matches
24- let items = split(a:base, '\.\|->')
25- if len(items) == 1
24+ if a:base !~ '\.\|->'
2625 " Only one part, no "." or "->": complete from tags file.
27- let diclist = taglist(items[0])
26+ let diclist = taglist(a:base)
2827 return map(diclist, 'v:val["name"]')
2928 endif
30- return items
29+
30+ " Find variable locally in function or file.
31+ let items = split(a:base, '\.\|->')
32+
33+ " At the moment we only do "aa.bb", not "aa.bb.cc"
34+ if len(items) > 2
35+ return []
36+ endif
37+
38+ let line = ''
39+ if searchdecl(items[0]) == 0 || searchdecl(items[0], 1) == 0
40+ " Found, now figure out the type.
41+ " TODO: join previous line if it makes sense
42+ let line = getline('.')
43+ let col = col('.')
44+ else
45+ " Find the variable in the tags file
46+ let diclist = taglist(items[0])
47+ for i in range(len(diclist))
48+ " For now we only recognize a variable.
49+ if diclist[i]['kind'] == 'v'
50+ let line = diclist[i]['cmd']
51+ if line[0] == '/' && line[1] == '^'
52+ " the command is a search pattern, remove the leading /^
53+ let line = strpart(line, 2)
54+ endif
55+ let col = match(line, items[0])
56+ break
57+ endif
58+ endfor
59+ endif
60+
61+ if line == ''
62+ return []
63+ endif
64+
65+ " Is there a * before the variable name?
66+ let col -= 1
67+ let star = 0
68+ while col > 0
69+ let col -= 1
70+ if line[col] == '*'
71+ let star = 1
72+ elseif line[col] !~ '\s'
73+ break
74+ endif
75+ endwhile
76+
77+ " Use the line up to the variable name and split it in tokens.
78+ let lead = strpart(line, 0, col + 1)
79+ let tokens = split(lead, '\s\+\|\<')
80+
81+ let basetext = matchstr(a:base, '.*\.\|->')
82+
83+ for i in range(len(tokens) - 1)
84+ if tokens[i] == 'struct'
85+ let name = tokens[i + 1]
86+ " Todo: Use all tags files; What about local structures?
87+ exe 'vimgrep /\<struct:' . name . '\>/j tags'
88+ let res = []
89+ for l in getqflist()
90+ let memb = matchstr(l['text'], '[^\t]*')
91+ if len(items) == 1 || memb =~ '^' . items[1]
92+ call add(res, basetext . memb)
93+ endif
94+ endfor
95+ return res
96+ endif
97+ endfor
98+
99+ return tokens
31100 endfunction
32101
diff -r 35cde31bdcbd -r 7e6d264ec0a2 runtime/doc/todo.txt
--- a/runtime/doc/todo.txt Mon Sep 05 22:11:52 2005 +0000
+++ b/runtime/doc/todo.txt Mon Sep 05 22:14:46 2005 +0000
@@ -1,4 +1,4 @@
1-*todo.txt* For Vim version 7.0aa. Last change: 2005 Sep 01
1+*todo.txt* For Vim version 7.0aa. Last change: 2005 Sep 05
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -86,6 +86,7 @@
8686 How to get the type of "var"?
8787 tags file doesn't give type of typedef! E.g., oparg_T is
8888 listed with "^} oparg_T;$"
89+ mlcscope may do it, but I can't find the sources
8990 How to get the members of that type?
9091 tags file has struct: and class: fields
9192
diff -r 35cde31bdcbd -r 7e6d264ec0a2 runtime/doc/version7.txt
--- a/runtime/doc/version7.txt Mon Sep 05 22:11:52 2005 +0000
+++ b/runtime/doc/version7.txt Mon Sep 05 22:14:46 2005 +0000
@@ -1,4 +1,4 @@
1-*version7.txt* For Vim version 7.0aa. Last change: 2005 Aug 31
1+*version7.txt* For Vim version 7.0aa. Last change: 2005 Sep 05
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -123,6 +123,10 @@
123123 s is replaced with "SS". This does not happen with "~" to avoid backwards
124124 compatibility problems and because "SS" can't be changed back to a sharp s.
125125
126+"gd" previously found the very first occurrence of a variable in a function,
127+that could be the function argument without type. Now it finds the position
128+where the type is given.
129+
126130 ==============================================================================
127131 NEW FEATURES *new-7*
128132
@@ -569,6 +573,8 @@
569573 ":function" and ":autocmd" commands will show where it was last defined.
570574 (Yegappan Lakshmanan)
571575
576+":function /pattern" lists functions matching the pattern.
577+
572578 ==============================================================================
573579 IMPROVEMENTS *improvements-7*
574580
diff -r 35cde31bdcbd -r 7e6d264ec0a2 src/eval.c
--- a/src/eval.c Mon Sep 05 22:11:52 2005 +0000
+++ b/src/eval.c Mon Sep 05 22:14:46 2005 +0000
@@ -580,6 +580,7 @@
580580 static void f_resolve __ARGS((typval_T *argvars, typval_T *rettv));
581581 static void f_reverse __ARGS((typval_T *argvars, typval_T *rettv));
582582 static void f_search __ARGS((typval_T *argvars, typval_T *rettv));
583+static void f_searchdecl __ARGS((typval_T *argvars, typval_T *rettv));
583584 static void f_searchpair __ARGS((typval_T *argvars, typval_T *rettv));
584585 static void f_server2client __ARGS((typval_T *argvars, typval_T *rettv));
585586 static void f_serverlist __ARGS((typval_T *argvars, typval_T *rettv));
@@ -6818,6 +6819,7 @@
68186819 {"resolve", 1, 1, f_resolve},
68196820 {"reverse", 1, 1, f_reverse},
68206821 {"search", 1, 2, f_search},
6822+ {"searchdecl", 1, 2, f_searchdecl},
68216823 {"searchpair", 3, 5, f_searchpair},
68226824 {"server2client", 2, 2, f_server2client},
68236825 {"serverlist", 0, 0, f_serverlist},
@@ -12976,6 +12978,28 @@
1297612978 }
1297712979
1297812980 /*
12981+ * "searchdecl()" function
12982+ */
12983+ static void
12984+f_searchdecl(argvars, rettv)
12985+ typval_T *argvars;
12986+ typval_T *rettv;
12987+{
12988+ int locally = 1;
12989+ int error = FALSE;
12990+ char_u *name;
12991+
12992+ rettv->vval.v_number = 1; /* default: FAIL */
12993+
12994+ name = get_tv_string_chk(&argvars[0]);
12995+ if (argvars[1].v_type != VAR_UNKNOWN)
12996+ locally = get_tv_number_chk(&argvars[1], &error) == 0;
12997+ if (!error && name != NULL)
12998+ rettv->vval.v_number = find_decl(name, (int)STRLEN(name),
12999+ locally, SEARCH_KEEP) == FAIL;
13000+}
13001+
13002+/*
1297913003 * "searchpair()" function
1298013004 */
1298113005 static void
@@ -16801,6 +16825,44 @@
1680116825 }
1680216826
1680316827 /*
16828+ * ":function /pat": list functions matching pattern.
16829+ */
16830+ if (*eap->arg == '/')
16831+ {
16832+ p = skip_regexp(eap->arg + 1, '/', TRUE, NULL);
16833+ if (!eap->skip)
16834+ {
16835+ regmatch_T regmatch;
16836+
16837+ c = *p;
16838+ *p = NUL;
16839+ regmatch.regprog = vim_regcomp(eap->arg + 1, RE_MAGIC);
16840+ *p = c;
16841+ if (regmatch.regprog != NULL)
16842+ {
16843+ regmatch.rm_ic = p_ic;
16844+
16845+ todo = func_hashtab.ht_used;
16846+ for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi)
16847+ {
16848+ if (!HASHITEM_EMPTY(hi))
16849+ {
16850+ --todo;
16851+ fp = HI2UF(hi);
16852+ if (!isdigit(*fp->uf_name)
16853+ && vim_regexec(&regmatch, fp->uf_name, 0))
16854+ list_func_head(fp, FALSE);
16855+ }
16856+ }
16857+ }
16858+ }
16859+ if (*p == '/')
16860+ ++p;
16861+ eap->nextcmd = check_nextcmd(p);
16862+ return;
16863+ }
16864+
16865+ /*
1680416866 * Get the function name. There are these situations:
1680516867 * func normal function name
1680616868 * "name" == func, "fudi.fd_dict" == NULL
diff -r 35cde31bdcbd -r 7e6d264ec0a2 src/proto/search.pro
--- a/src/proto/search.pro Mon Sep 05 22:11:52 2005 +0000
+++ b/src/proto/search.pro Mon Sep 05 22:14:46 2005 +0000
@@ -17,7 +17,7 @@
1717 pos_T *findmatchlimit __ARGS((oparg_T *oap, int initc, int flags, int maxtravel));
1818 void showmatch __ARGS((int c));
1919 int findsent __ARGS((int dir, long count));
20-int findpar __ARGS((oparg_T *oap, int dir, long count, int what, int both));
20+int findpar __ARGS((int *pincl, int dir, long count, int what, int both));
2121 int startPS __ARGS((linenr_T lnum, int para, int both));
2222 int fwd_word __ARGS((long count, int bigword, int eol));
2323 int bck_word __ARGS((long count, int bigword, int stop));
Afficher sur ancien navigateur de dépôt.