mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
Merge pull request #13098 from atom/b3-toggle-line-comments
Fix toggleLineCommentsInSelection for empty lines
This commit is contained in:
commit
630f146884
@ -4335,6 +4335,13 @@ describe "TextEditor", ->
|
||||
editor.toggleLineCommentsInSelection()
|
||||
expect(buffer.lineForRow(4)).toBe " while(items.length > 0) {"
|
||||
|
||||
it "does nothing for empty lines and null grammar", ->
|
||||
runs ->
|
||||
editor.setGrammar(atom.grammars.grammarForScopeName('text.plain.null-grammar'))
|
||||
editor.setCursorBufferPosition([10, 0])
|
||||
editor.toggleLineCommentsInSelection()
|
||||
expect(editor.buffer.lineForRow(10)).toBe ""
|
||||
|
||||
it "uncomments when the line lacks the trailing whitespace in the comment regex", ->
|
||||
editor.setCursorBufferPosition([10, 0])
|
||||
editor.toggleLineCommentsInSelection()
|
||||
|
@ -27,7 +27,7 @@ class LanguageMode
|
||||
toggleLineCommentsForBufferRows: (start, end) ->
|
||||
scope = @editor.scopeDescriptorForBufferPosition([start, 0])
|
||||
commentStrings = @editor.getCommentStrings(scope)
|
||||
return unless commentStrings?
|
||||
return unless commentStrings?.commentStartString
|
||||
{commentStartString, commentEndString} = commentStrings
|
||||
|
||||
buffer = @editor.buffer
|
||||
|
Loading…
Reference in New Issue
Block a user