mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-18 01:38:57 +00:00
Support another c brace style re. #64
This commit is contained in:
@@ -21,12 +21,16 @@ let s:adjust_max = 7
|
|||||||
|
|
||||||
function! matchup#quirks#status_adjust(offscreen) abort " {{{1
|
function! matchup#quirks#status_adjust(offscreen) abort " {{{1
|
||||||
if a:offscreen.match ==# '{' && matchup#quirks#isclike()
|
if a:offscreen.match ==# '{' && matchup#quirks#isclike()
|
||||||
\ && strpart(getline(a:offscreen.lnum),
|
if strpart(getline(a:offscreen.lnum),
|
||||||
\ 0, a:offscreen.cnum-1) =~# '^\s*$'
|
\ 0, a:offscreen.cnum-1) =~# '^\s*$'
|
||||||
|
let l:target = indent(a:offscreen.lnum)
|
||||||
|
else
|
||||||
|
let l:target = indent(a:offscreen.links.close.lnum)
|
||||||
|
endif
|
||||||
" go up to next line with same indent (up to s:adjust_max)
|
" go up to next line with same indent (up to s:adjust_max)
|
||||||
for l:adjust in range(-1, -s:adjust_max, -1)
|
for l:adjust in range(-1, -s:adjust_max, -1)
|
||||||
let l:lnum = a:offscreen.lnum + l:adjust
|
let l:lnum = a:offscreen.lnum + l:adjust
|
||||||
if indent(l:lnum) == indent(a:offscreen.lnum)
|
if indent(l:lnum) == l:target
|
||||||
\ && getline(l:lnum) !~ '^\s*\%(#\|/\*\|//\)'
|
\ && getline(l:lnum) !~ '^\s*\%(#\|/\*\|//\)'
|
||||||
return l:adjust
|
return l:adjust
|
||||||
endif
|
endif
|
||||||
|
|||||||
11
test/issues/64/ast.cc
Normal file
11
test/issues/64/ast.cc
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Error ASTNodeImporter::ImportFunctionDeclBody(FunctionDecl *FromFD,
|
||||||
|
FunctionDecl *ToFD) {
|
||||||
|
if (Stmt *FromBody = FromFD->getBody()) {
|
||||||
|
if (ExpectedStmt ToBodyOrErr = import(FromBody))
|
||||||
|
ToFD->setBody(*ToBodyOrErr);
|
||||||
|
else
|
||||||
|
return ToBodyOrErr.takeError();
|
||||||
|
}
|
||||||
|
return Error::success();
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user