Only uncomment when all lines start with a comment

Previously only the first row was checked for a comment. Now all
rows are checked and the rows are only uncommented when they all
start with a comment.

This only impacts languages that do not specify a command end pattern.

Closes #554
This commit is contained in:
Kevin Sawicki
2013-06-05 17:38:50 -07:00
parent 520e510aab
commit d658e7c490
2 changed files with 25 additions and 0 deletions

View File

@@ -64,6 +64,10 @@ class LanguageMode
buffer.insert([start, 0], commentStartString)
buffer.insert([end, buffer.lineLengthForRow(end)], commentEndString)
else
if shouldUncomment and start isnt end
shouldUncomment = [start+1..end].every (row) ->
line = buffer.lineForRow(row)
not line or commentStartRegex.test(line)
if shouldUncomment
for row in [start..end]
if match = commentStartRegex.search(buffer.lineForRow(row))