mirror of
https://github.com/atom/atom.git
synced 2026-01-25 14:59:03 -05:00
If selection is empty when toggling a line comment, keep it empty
This commit is contained in:
@@ -292,6 +292,13 @@ describe "Selection", ->
|
||||
expect(buffer.lineForRow(6)).toBe " current < pivot ? left.push(current) : right.push(current);"
|
||||
expect(buffer.lineForRow(7)).toBe " }"
|
||||
|
||||
it "preserves selection emptiness", ->
|
||||
editor.attachToDom()
|
||||
selection.setBufferRange([[4, 0], [4, 0]])
|
||||
selection.toggleLineComments()
|
||||
expect(selection.isEmpty()).toBeTruthy()
|
||||
expect(selection.find('.selection')).not.toExist()
|
||||
|
||||
describe "when the selection ends on the begining of a fold line", ->
|
||||
beforeEach ->
|
||||
editor.createFold(2,4)
|
||||
|
||||
@@ -248,7 +248,6 @@ class Renderer
|
||||
@lineMap.logLines(start, end)
|
||||
|
||||
toggleLineCommentsInRange: (range) ->
|
||||
console.log range.inspect()
|
||||
@lineCommenter.toggleLineCommentsInRange(range)
|
||||
|
||||
_.extend Renderer.prototype, EventEmitter
|
||||
|
||||
@@ -20,6 +20,7 @@ class Selection extends View
|
||||
handleBufferChange: (e) ->
|
||||
return unless @anchor
|
||||
@anchor.handleBufferChange(e)
|
||||
@updateAppearance()
|
||||
|
||||
placeAnchor: ->
|
||||
return if @anchor
|
||||
|
||||
Reference in New Issue
Block a user