From 3ac216b65f8281f0c24b3b2dfac7c892bff08399 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke <marijn@haverbeke.nl>
Date: Mon, 15 Aug 2016 12:34:39 +0200
Subject: [PATCH] [comment addon] Remove misguided test

Closes #4148
---
 addon/comment/comment.js | 2 +-
 test/comment_test.js     | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/addon/comment/comment.js b/addon/comment/comment.js
index 2c4f975d0..2f2f071df 100644
--- a/addon/comment/comment.js
+++ b/addon/comment/comment.js
@@ -140,7 +140,7 @@
         var line = self.getLine(i);
         var found = line.indexOf(lineString);
         if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
-        if (found == -1 && (i != end || i == start) && nonWS.test(line)) break lineComment;
+        if (found == -1 && nonWS.test(line)) break lineComment;
         if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
         lines.push(line);
       }
diff --git a/test/comment_test.js b/test/comment_test.js
index 26e474493..3e6a86bbf 100644
--- a/test/comment_test.js
+++ b/test/comment_test.js
@@ -97,4 +97,9 @@ namespace = "comment_";
   test("dontMessWithStrings3", "javascript", function(cm) {
     cm.execCommand("toggleComment");
   }, "// console.log(\"// string\");", "console.log(\"// string\");");
+
+  test("includeLastLine", "javascript", function(cm) {
+    cm.execCommand("selectAll")
+    cm.execCommand("toggleComment")
+  }, "// foo\n// bar\nbaz", "// // foo\n// // bar\n// baz")
 })();
-- 
GitLab