mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
🐛 Guard against unexisting screen rows
This commit is contained in:
parent
87489d4b0b
commit
e6cb5c8e89
@ -4561,7 +4561,8 @@ describe "TextEditor", ->
|
||||
it '.lineTextForScreenRow(row)', ->
|
||||
editor.foldBufferRow(4)
|
||||
expect(editor.lineTextForScreenRow(5)).toEqual ' return sort(left).concat(pivot).concat(sort(right));'
|
||||
expect(editor.lineTextForScreenRow(100)).not.toBeDefined()
|
||||
expect(editor.lineTextForScreenRow(9)).toEqual '};'
|
||||
expect(editor.lineTextForScreenRow(10)).toBeUndefined()
|
||||
|
||||
describe ".deleteLine()", ->
|
||||
it "deletes the first line when the cursor is there", ->
|
||||
|
@ -783,6 +783,7 @@ class TextEditor extends Model
|
||||
@displayLayer.tagForCode(tagCode)
|
||||
|
||||
screenLineForScreenRow: (screenRow) ->
|
||||
return if screenRow < 0 or screenRow > @getLastScreenRow()
|
||||
@displayLayer.getScreenLines(screenRow, screenRow + 1)[0]
|
||||
|
||||
bufferRowForScreenRow: (row) -> @displayLayer.translateScreenPosition(Point(row, 0)).row
|
||||
|
Loading…
Reference in New Issue
Block a user