mirror of
https://github.com/atom/atom.git
synced 2026-02-18 10:31:54 -05:00
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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user