mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
If command panel selects text within a fold, the fold is destroyed
This commit is contained in:
@@ -232,4 +232,16 @@ describe "CommandInterpreter", ->
|
||||
|
||||
interpreter.eval(editor, 's/current/foo/g')
|
||||
expect(buffer.lineForRow(5)).toBe ' foo = items.shift();'
|
||||
expect(buffer.lineForRow(6)).toBe ' foo < pivot ? left.push(foo) : right.push(current);'
|
||||
expect(buffer.lineForRow(6)).toBe ' foo < pivot ? left.push(foo) : right.push(current);'
|
||||
|
||||
describe "when command selects folded text", ->
|
||||
it "unfolds lines that command selects", ->
|
||||
editor.createFold(1, 9)
|
||||
editor.createFold(5, 8)
|
||||
editor.setSelectedBufferRange([[0,0], [0,0]])
|
||||
|
||||
interpreter.eval(editor, '/push/')
|
||||
expect(editor.getSelection().getBufferRange()).toEqual [[6,29], [6,33]]
|
||||
expect(editor.lineForScreenRow(1).fold).toBeUndefined()
|
||||
expect(editor.lineForScreenRow(5).fold).toBeUndefined()
|
||||
expect(editor.lineForScreenRow(6).text).toBe buffer.lineForRow(6)
|
||||
|
||||
@@ -217,6 +217,7 @@ class Editor extends View
|
||||
softWrapColumn ?= @calcSoftWrapColumn()
|
||||
@activeEditSession.setSoftWrapColumn(softWrapColumn) if softWrapColumn
|
||||
|
||||
lineForScreenRow: (screenRow) -> @activeEditSession.lineForScreenRow(screenRow)
|
||||
linesForScreenRows: (start, end) -> @activeEditSession.linesForScreenRows(start, end)
|
||||
screenLineCount: -> @activeEditSession.screenLineCount()
|
||||
maxScreenLineLength: -> @activeEditSession.maxScreenLineLength()
|
||||
|
||||
@@ -10,6 +10,11 @@ class CompositeCommand
|
||||
currentRanges = editor.getSelectionsOrderedByBufferPosition().map (selection) -> selection.getBufferRange()
|
||||
for currentRange in currentRanges
|
||||
newRanges.push(command.execute(editor, currentRange)...)
|
||||
|
||||
for range in newRanges
|
||||
for row in [range.start.row..range.end.row]
|
||||
editor.destroyFoldsContainingBufferRow(row)
|
||||
|
||||
editor.setSelectedBufferRanges(newRanges)
|
||||
|
||||
reverse: ->
|
||||
|
||||
Reference in New Issue
Block a user