mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Folds are destroyed when their placeholder line is clicked
This commit is contained in:
@@ -2425,22 +2425,18 @@ describe "Editor", ->
|
||||
expect(editor.getSelection().isEmpty()).toBeTruthy()
|
||||
expect(editor.getCursorScreenPosition()).toEqual [5, 0]
|
||||
|
||||
# describe "when a fold placeholder is clicked", ->
|
||||
# it "removes the associated fold and places the cursor at its beginning", ->
|
||||
# editor.getSelection().setBufferRange(new Range([4, 29], [7, 4]))
|
||||
# editor.trigger 'fold-selection'
|
||||
describe "when a fold placeholder line is clicked", ->
|
||||
fit "removes the associated fold and places the cursor at its beginning", ->
|
||||
editor.getSelection().setBufferRange(new Range([3, 0], [9, 0]))
|
||||
editor.trigger 'fold-selection'
|
||||
|
||||
# editor.find('.fold-placeholder .ellipsis').mousedown()
|
||||
editor.find('.fold.line').mousedown()
|
||||
|
||||
# expect(editor.find('.fold-placeholder')).not.toExist()
|
||||
# expect(editor.visibleLines.find('.line:eq(5)').text()).toBe ' current = items.shift();'
|
||||
expect(editor.find('.fold')).not.toExist()
|
||||
expect(editor.visibleLines.find('.line:eq(4)').text()).toMatch /4-+/
|
||||
expect(editor.visibleLines.find('.line:eq(5)').text()).toMatch /5/
|
||||
|
||||
# expect(editor.getCursorBufferPosition()).toEqual [4, 29]
|
||||
|
||||
# describe "when there is nothing on a line except a fold placeholder", ->
|
||||
# it "follows the placeholder with a non-breaking space to ensure the line has the proper height", ->
|
||||
# editor.createFold([[1, 0], [1, 30]])
|
||||
# expect(editor.visibleLines.find('.line:eq(1)').html()).toMatch / $/
|
||||
expect(editor.getCursorBufferPosition()).toEqual [3, 0]
|
||||
|
||||
describe "editor-path-change event", ->
|
||||
it "emits event when buffer's path is changed", ->
|
||||
|
||||
@@ -173,8 +173,8 @@ class Editor extends View
|
||||
@isFocused = false
|
||||
@removeClass 'focused'
|
||||
|
||||
@visibleLines.on 'mousedown', '.fold-placeholder', (e) =>
|
||||
@destroyFold($(e.currentTarget).attr('foldId'))
|
||||
@visibleLines.on 'mousedown', '.fold.line', (e) =>
|
||||
@destroyFold($(e.currentTarget).attr('fold-id'))
|
||||
false
|
||||
|
||||
@visibleLines.on 'mousedown', (e) =>
|
||||
@@ -464,9 +464,11 @@ class Editor extends View
|
||||
|
||||
$$ ->
|
||||
for line in lines
|
||||
lineClass = 'line'
|
||||
lineClass += ' fold' if line.fold?
|
||||
@div class: lineClass, =>
|
||||
if fold = line.fold
|
||||
lineAttributes = { class: 'fold line', 'fold-id': fold.id }
|
||||
else
|
||||
lineAttributes = { class: 'line' }
|
||||
@div lineAttributes, =>
|
||||
if line.text == ''
|
||||
@raw ' ' if line.text == ''
|
||||
else
|
||||
@@ -690,7 +692,7 @@ class Editor extends View
|
||||
destroyFold: (foldId) ->
|
||||
fold = @renderer.foldsById[foldId]
|
||||
fold.destroy()
|
||||
@setCursorBufferPosition(fold.start)
|
||||
@setCursorBufferPosition([fold.startRow, 0])
|
||||
|
||||
splitLeft: ->
|
||||
@pane()?.splitLeft(@copy()).wrappedView
|
||||
|
||||
Reference in New Issue
Block a user