diff options
author | watiko <service@mail.watiko.net> | 2016-02-15 19:12:47 +0900 |
---|---|---|
committer | watiko <service@mail.watiko.net> | 2016-02-15 19:13:15 +0900 |
commit | 72d5a88af5f417a8312408d85dbb6949f64146b2 (patch) | |
tree | 02059e9045058cb8bfcaead69ab75272a221ec75 /src | |
parent | 2d5cba630c13d45e8a0125fe87a7c85b878c0b6f (diff) | |
download | rneovim-72d5a88af5f417a8312408d85dbb6949f64146b2.tar.gz rneovim-72d5a88af5f417a8312408d85dbb6949f64146b2.tar.bz2 rneovim-72d5a88af5f417a8312408d85dbb6949f64146b2.zip |
vim-patch:7.4.893
Problem: C indenting is wrong below a "case (foo):" because it is
recognized as a C++ base class construct. Issue #38.
Solution: Check for the case keyword.
https://github.com/vim/vim/commit/d1b15dec4d00d7ed5e92ff4e0fb7fc2e0818e479
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/indent_c.c | 14 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 7cd8dd62de..3def0defe3 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -1132,13 +1132,21 @@ static int cin_is_cpp_baseclass(cpp_baseclass_cache_T *cached) { pos->lnum = lnum; line = ml_get(lnum); - s = cin_skipcomment(line); + s = line; for (;; ) { if (*s == NUL) { - if (lnum == curwin->w_cursor.lnum) + if (lnum == curwin->w_cursor.lnum) { break; - /* Continue in the cursor line. */ + } + // Continue in the cursor line. line = ml_get(++lnum); + s = line; + } + if (s == line) { + // don't recognize "case (foo):" as a baseclass */ + if (cin_iscase(s, false)) { + break; + } s = cin_skipcomment(line); if (*s == NUL) continue; diff --git a/src/nvim/version.c b/src/nvim/version.c index c5781412e7..5a46049e27 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -395,7 +395,7 @@ static int included_patches[] = { // 896, // 895, // 894 NA - // 893, + 893, // 892, 891, // 890 NA |