mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.1291: C indent wrong when * immediately follows comment
Problem: C indent wrong when * immediately follows comment. (John Bowler)
Solution: Do not see "/*" after "*" as a comment start. (closes vim/vim#2321)
f8c53d3d26
This commit is contained in:
parent
c553109932
commit
2c0998e104
@ -1849,7 +1849,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|
||||
} else { /* Searching backwards */
|
||||
/*
|
||||
* A comment may contain / * or / /, it may also start or end
|
||||
* with / * /. Ignore a / * after / /.
|
||||
* with / * /. Ignore a / * after / / and after *.
|
||||
*/
|
||||
if (pos.col == 0)
|
||||
continue;
|
||||
@ -1874,6 +1874,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|
||||
}
|
||||
} else if ( linep[pos.col - 1] == '/'
|
||||
&& linep[pos.col] == '*'
|
||||
&& (pos.col == 1 || linep[pos.col - 2] != '*')
|
||||
&& (int)pos.col < comment_col) {
|
||||
count++;
|
||||
match_pos = pos;
|
||||
|
@ -4754,4 +4754,21 @@ describe('cindent', function()
|
||||
4
|
||||
/* end of define */]=])
|
||||
end)
|
||||
|
||||
it('* immediately follows comment / vim-patch 8.0.1291', function()
|
||||
insert_([=[
|
||||
{
|
||||
a = second/*bug*/*line;
|
||||
}]=])
|
||||
|
||||
feed_command('set cin cino&')
|
||||
feed_command('/a = second')
|
||||
feed('ox')
|
||||
|
||||
expect([=[
|
||||
{
|
||||
a = second/*bug*/*line;
|
||||
x
|
||||
}]=])
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user