mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Backspace in column 0 below a fold absorbs line into fold
This commit is contained in:
@@ -764,6 +764,17 @@ describe "EditSession", ->
|
||||
editSession.setCursorScreenPosition(row: 0, column: 0)
|
||||
editSession.backspace()
|
||||
|
||||
describe "when the cursor is on the first column of a line below a fold", ->
|
||||
it "absorbs the current line into the fold", ->
|
||||
editSession.setCursorScreenPosition([4,0])
|
||||
editSession.toggleFold()
|
||||
editSession.setCursorScreenPosition([5,0])
|
||||
editSession.backspace()
|
||||
|
||||
|
||||
expect(buffer.lineForRow(7)).toBe " } return sort(left).concat(pivot).concat(sort(right));"
|
||||
expect(buffer.lineForRow(8)).toBe " };"
|
||||
|
||||
describe "when there are multiple cursors", ->
|
||||
describe "when cursors are on the same line", ->
|
||||
it "removes the characters preceding each cursor", ->
|
||||
|
||||
@@ -198,6 +198,9 @@ class EditSession
|
||||
destroyFoldsContainingBufferRow: (bufferRow) ->
|
||||
@renderer.destroyFoldsContainingBufferRow(bufferRow)
|
||||
|
||||
isFoldedAtScreenRow: (screenRow) ->
|
||||
@screenLineForRow(screenRow).fold?
|
||||
|
||||
toggleLineCommentsInRange: (range) ->
|
||||
@renderer.toggleLineCommentsInRange(range)
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ class Editor extends View
|
||||
@screenLineCount() - 1
|
||||
|
||||
isFoldedAtScreenRow: (screenRow) ->
|
||||
@screenLineForRow(screenRow).fold?
|
||||
@activeEditSession.isFoldedAtScreenRow(screenRow)
|
||||
|
||||
destroyFoldsContainingBufferRow: (bufferRow) ->
|
||||
@renderer.destroyFoldsContainingBufferRow(bufferRow)
|
||||
|
||||
@@ -86,6 +86,9 @@ class Selection
|
||||
selectToScreenPosition: (position) ->
|
||||
@modifySelection => @cursor.setScreenPosition(position)
|
||||
|
||||
selectToBufferPosition: (position) ->
|
||||
@modifySelection => @cursor.setBufferPosition(position)
|
||||
|
||||
selectRight: ->
|
||||
@modifySelection => @cursor.moveRight()
|
||||
|
||||
@@ -131,7 +134,13 @@ class Selection
|
||||
|
||||
backspace: ->
|
||||
@editSession.destroyFoldsContainingBufferRow(@getBufferRange().end.row)
|
||||
@selectLeft() if @isEmpty()
|
||||
|
||||
if @isEmpty()
|
||||
if @editSession.isFoldedAtScreenRow(@cursor.getCurrentScreenRow() - 1)
|
||||
@selectToBufferPosition([@cursor.getCurrentBufferRow() - 1, Infinity])
|
||||
else
|
||||
@selectLeft()
|
||||
|
||||
@deleteSelectedText()
|
||||
|
||||
backspaceToBeginningOfWord: ->
|
||||
|
||||
Reference in New Issue
Block a user