Skip to content

Commit

Permalink
Use imperative style and standard JS regex
Browse files Browse the repository at this point in the history
Based on pull request feedback
  • Loading branch information
Lee Dohm committed Jun 10, 2014
1 parent a2c9c21 commit 3cf4b7b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/language-mode.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ class LanguageMode
buffer.insert([start, indentLength], commentStartString)
buffer.insert([end, buffer.lineLengthForRow(end)], commentEndString)
else
blankRegex = new OnigRegExp("^\\s*$")

allBlank = true
allBlankOrCommented = [start..end].every (row) ->
allBlankOrCommented = true

for row in [start..end]
line = buffer.lineForRow(row)
blank = not line or blankRegex.test(line)
blank = line?.match(/^\s*$/)

allBlank = allBlank and blank
blank or commentStartRegex.test(line)
allBlank = false unless blank
allBlankOrCommented = false unless blank or commentStartRegex.test(line)

shouldUncomment = allBlankOrCommented and not allBlank

Expand Down

0 comments on commit 3cf4b7b

Please sign in to comment.