mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 18:24:09 +03:00
Don't skip shorter lines when the adding empty selection below
This commit is contained in:
parent
131df22c11
commit
393cba4d42
@ -756,6 +756,19 @@ describe "EditSession", ->
|
||||
[[6, 22], [6, 28]]
|
||||
]
|
||||
|
||||
describe "when the selection is empty", ->
|
||||
it "does not skip lines that are shorter than the current column", ->
|
||||
editSession.setCursorBufferPosition([3, 36])
|
||||
editSession.addSelectionBelow()
|
||||
editSession.addSelectionBelow()
|
||||
editSession.addSelectionBelow()
|
||||
expect(editSession.getSelectedBufferRanges()).toEqual [
|
||||
[[3, 36], [3, 36]]
|
||||
[[4, 29], [4, 29]]
|
||||
[[5, 30], [5, 30]]
|
||||
[[6, 36], [6, 36]]
|
||||
]
|
||||
|
||||
describe "when the cursor is moved while there is a selection", ->
|
||||
makeSelection = -> selection.setBufferRange [[1, 2], [1, 5]]
|
||||
|
||||
|
@ -155,12 +155,18 @@ class Selection
|
||||
addSelectionBelow: ->
|
||||
range = (@goalBufferRange ? @getBufferRange()).copy()
|
||||
nextRow = range.end.row + 1
|
||||
for row in [nextRow..@editSession.getLastBufferRow()]
|
||||
range.start.row = row
|
||||
range.end.row = row
|
||||
unless @editSession.clipBufferRange(range).isEmpty()
|
||||
@editSession.addSelectionForBufferRange(range, goalBufferRange: range, suppressMerge: true)
|
||||
break
|
||||
|
||||
if range.isEmpty()
|
||||
range.start.row = nextRow
|
||||
range.end.row = nextRow
|
||||
@editSession.addSelectionForBufferRange(range, goalBufferRange: range, suppressMerge: true)
|
||||
else
|
||||
for row in [nextRow..@editSession.getLastBufferRow()]
|
||||
range.start.row = row
|
||||
range.end.row = row
|
||||
unless @editSession.clipBufferRange(range).isEmpty()
|
||||
@editSession.addSelectionForBufferRange(range, goalBufferRange: range, suppressMerge: true)
|
||||
break
|
||||
|
||||
insertText: (text, options={}) ->
|
||||
oldBufferRange = @getBufferRange()
|
||||
|
Loading…
Reference in New Issue
Block a user