diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-19 23:11:36 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-20 00:05:12 -0400 |
commit | 2c0998e104bb94bcc52f3aaa37747477fbe59782 (patch) | |
tree | fb645145da0a73cdf453dec44bbb7db19cc1239f | |
parent | c5531099320e2cb2f700b7146e27026f1530e41d (diff) | |
download | rneovim-2c0998e104bb94bcc52f3aaa37747477fbe59782.tar.gz rneovim-2c0998e104bb94bcc52f3aaa37747477fbe59782.tar.bz2 rneovim-2c0998e104bb94bcc52f3aaa37747477fbe59782.zip |
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)
https://github.com/vim/vim/commit/f8c53d3d268fc67a29c8c1a4e76fae85762e11b5
-rw-r--r-- | src/nvim/search.c | 3 | ||||
-rw-r--r-- | test/functional/legacy/003_cindent_spec.lua | 17 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index 457a6c309d..dc4ae2e847 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -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; diff --git a/test/functional/legacy/003_cindent_spec.lua b/test/functional/legacy/003_cindent_spec.lua index 1cede8a7d7..061904c42f 100644 --- a/test/functional/legacy/003_cindent_spec.lua +++ b/test/functional/legacy/003_cindent_spec.lua @@ -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) |