about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSeiichi Uchida <seuchida@gmail.com>2019-02-05 14:03:05 +0900
committerGitHub <noreply@github.com>2019-02-05 14:03:05 +0900
commitaec0a7c99952649e8fbf9bf5f4609af470c17c83 (patch)
treea3d179efa7635bc85f9a252db960d75ebc51b625 /src
parent81067b11a4fd663c53e5aab506b8680836c4cc1e (diff)
parent5fcb7507cac3e2f2818add67151b7aea2e12a6c0 (diff)
Merge pull request #3318 from rchaser53/issue-3314
fix Removed indentation after nested comments error
Diffstat (limited to 'src')
-rw-r--r--src/comment.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/comment.rs b/src/comment.rs
index 7b3a21fa4af..5845fc69227 100644
--- a/src/comment.rs
+++ b/src/comment.rs
@@ -321,6 +321,7 @@ fn identify_comment(
         // for a block comment, search for the closing symbol
         CommentStyle::DoubleBullet | CommentStyle::SingleBullet | CommentStyle::Exclamation => {
             let closer = style.closer().trim_start();
+            let mut count = orig.matches(closer).count();
             let mut closing_symbol_offset = 0;
             let mut hbl = false;
             let mut first = true;
@@ -341,7 +342,10 @@ fn identify_comment(
                     first = false;
                 }
                 if trimmed_line.ends_with(closer) {
-                    break;
+                    count -= 1;
+                    if count == 0 {
+                        break;
+                    }
                 }
             }
             (hbl, closing_symbol_offset)