From 72d5a88af5f417a8312408d85dbb6949f64146b2 Mon Sep 17 00:00:00 2001 From: watiko Date: Mon, 15 Feb 2016 19:12:47 +0900 Subject: 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 --- src/nvim/indent_c.c | 14 +++++++++++--- src/nvim/version.c | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src') 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 -- cgit