mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-14 04:29:04 +03:00
Merge branch 'master' into snippets
This commit is contained in:
commit
6389b19b7c
@ -740,6 +740,13 @@ describe "EditSession", ->
|
||||
|
||||
describe ".backspace()", ->
|
||||
describe "when there is a single cursor", ->
|
||||
changeScreenRangeHandler = null
|
||||
|
||||
beforeEach ->
|
||||
selection = editSession.getLastSelection()
|
||||
changeScreenRangeHandler = jasmine.createSpy('changeScreenRangeHandler')
|
||||
selection.on 'change-screen-range', changeScreenRangeHandler
|
||||
|
||||
describe "when the cursor is on the middle of the line", ->
|
||||
it "removes the character before the cursor", ->
|
||||
editSession.setCursorScreenPosition(row: 1, column: 7)
|
||||
@ -750,6 +757,7 @@ describe "EditSession", ->
|
||||
line = buffer.lineForRow(1)
|
||||
expect(line).toBe " var ort = function(items) {"
|
||||
expect(editSession.getCursorScreenPosition()).toEqual {row: 1, column: 6}
|
||||
expect(changeScreenRangeHandler).toHaveBeenCalled()
|
||||
|
||||
describe "when the cursor is at the beginning of a line", ->
|
||||
it "joins it with the line above", ->
|
||||
@ -764,9 +772,10 @@ describe "EditSession", ->
|
||||
line1 = buffer.lineForRow(1)
|
||||
expect(line0).toBe "var quicksort = function () { var sort = function(items) {"
|
||||
expect(line1).toBe " if (items.length <= 1) return items;"
|
||||
|
||||
expect(editSession.getCursorScreenPosition()).toEqual [0, originalLine0.length]
|
||||
|
||||
expect(changeScreenRangeHandler).toHaveBeenCalled()
|
||||
|
||||
describe "when the cursor is at the first column of the first line", ->
|
||||
it "does nothing, but doesn't raise an error", ->
|
||||
editSession.setCursorScreenPosition(row: 0, column: 0)
|
||||
|
@ -164,10 +164,9 @@ class Selection
|
||||
includeNewline = bufferRange.start.column == 0 or bufferRange.start.row >= fold.startRow
|
||||
bufferRange = bufferRange.union(fold.getBufferRange({ includeNewline }))
|
||||
|
||||
@modifyScreenRange =>
|
||||
@editSession.buffer.delete(bufferRange) unless bufferRange.isEmpty()
|
||||
if @cursor
|
||||
@cursor.setBufferPosition(bufferRange.start)
|
||||
@clear()
|
||||
@cursor?.setBufferPosition(bufferRange.start)
|
||||
|
||||
indentSelectedRows: ->
|
||||
range = @getBufferRange()
|
||||
@ -222,6 +221,7 @@ class Selection
|
||||
modifyScreenRange: (fn) ->
|
||||
oldScreenRange = @getScreenRange()
|
||||
fn()
|
||||
if @cursor
|
||||
newScreenRange = @getScreenRange()
|
||||
@trigger 'change-screen-range', newScreenRange unless oldScreenRange.isEqual(newScreenRange)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user