Make click of fold marker unfold the row

This commit is contained in:
Ben Ogle
2014-06-18 14:07:06 -07:00
parent 7a9710b8c3
commit d5ea766541
2 changed files with 16 additions and 0 deletions

View File

@@ -1007,6 +1007,17 @@ describe "EditorComponent", ->
nextAnimationFrame()
expect(editor.getSelectedScreenRange()).toEqual [[2, 4], [6, 8]]
describe "when a line is folded", ->
beforeEach ->
editor.foldBufferRow 4
describe "when the folded line's fold-marker is clicked", ->
it "unfolds the buffer row", ->
target = component.lineNodeForScreenRow(4).querySelector '.fold-marker'
linesNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenPosition([4, 8]), {target}))
expect(editor.isFoldedAtBufferRow 4).toBe false
clientCoordinatesForScreenPosition = (screenPosition) ->
positionOffset = editor.pixelPositionForScreenPosition(screenPosition)
scrollViewClientRect = node.querySelector('.scroll-view').getBoundingClientRect()

View File

@@ -485,6 +485,11 @@ EditorComponent = React.createClass
{detail, shiftKey, metaKey} = event
screenPosition = @screenPositionForMouseEvent(event)
if event.target?.classList.contains('fold-marker')
bufferRow = editor.bufferRowForScreenRow(screenPosition.row)
editor.unfoldBufferRow(bufferRow)
return
if shiftKey
editor.selectToScreenPosition(screenPosition)
else if metaKey