summaryrefslogtreecommitdiff
path: root/runtime/autoload/ccomplete.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2008-06-24 22:58:06 +0000
committerBram Moolenaar <Bram@vim.org>2008-06-24 22:58:06 +0000
commit8c8de839325eda0bed68917d18179d2003b344d1 (patch)
treec65b80f0a627f2e77385a07a62ee4206465cbc22 /runtime/autoload/ccomplete.vim
parent864207de089119377a1e1e5d411307d8eb57399e (diff)
downloadvim-git-8c8de839325eda0bed68917d18179d2003b344d1.tar.gz
updated for version 7.2av7.2a
Diffstat (limited to 'runtime/autoload/ccomplete.vim')
-rw-r--r--runtime/autoload/ccomplete.vim25
1 files changed, 23 insertions, 2 deletions
diff --git a/runtime/autoload/ccomplete.vim b/runtime/autoload/ccomplete.vim
index 0f013d79b..6850e19a0 100644
--- 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 May 08
+" Last Change: 2007 Aug 30
" This function is used for the 'omnifunc' option.
@@ -119,6 +119,27 @@ function! ccomplete#Complete(findstart, base)
" TODO: join previous line if it makes sense
let line = getline('.')
let col = col('.')
+ if stridx(strpart(line, 0, col), ';') != -1
+ " Handle multiple declarations on the same line.
+ let col2 = col - 1
+ while line[col2] != ';'
+ let col2 -= 1
+ endwhile
+ let line = strpart(line, col2 + 1)
+ let col -= col2
+ endif
+ if stridx(strpart(line, 0, col), ',') != -1
+ " Handle multiple declarations on the same line in a function
+ " declaration.
+ let col2 = col - 1
+ while line[col2] != ','
+ let col2 -= 1
+ endwhile
+ if strpart(line, col2 + 1, col - col2 - 1) =~ ' *[^ ][^ ]* *[^ ]'
+ let line = strpart(line, col2 + 1)
+ let col -= col2
+ endif
+ endif
if len(items) == 1
" Completing one word and it's a local variable: May add '[', '.' or
" '->'.
@@ -140,7 +161,7 @@ function! ccomplete#Complete(findstart, base)
let res = [{'match': match, 'tagline' : '', 'kind' : kind, 'info' : line}]
else
" Completing "var.", "var.something", etc.
- let res = s:Nextitem(strpart(line, 0, col), items[1:], 0, 1)
+ let res = s:Nextitem(strpart(line, 0, col), items[-1], 0, 1)
endif
endif