mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-28 00:52:29 +03:00
parent
d14e5a6992
commit
d150170e5b
@ -1766,6 +1766,14 @@ describe "Editor", ->
|
||||
expect(editor.gutter.find('.line-number:first').intValue()).toBe 2
|
||||
expect(editor.gutter.find('.line-number:last').intValue()).toBe 11
|
||||
|
||||
it "re-renders the correct line number range when there are folds", ->
|
||||
editor.activeEditSession.foldBufferRow(1)
|
||||
expect(editor.gutter.find('.line-number-1')).toHaveClass 'fold'
|
||||
|
||||
buffer.insert([0, 0], '\n')
|
||||
|
||||
expect(editor.gutter.find('.line-number-2')).toHaveClass 'fold'
|
||||
|
||||
describe "when wrapping is on", ->
|
||||
it "renders a • instead of line number for wrapped portions of lines", ->
|
||||
editSession.setSoftWrap(true)
|
||||
|
@ -141,12 +141,23 @@ class Gutter extends View
|
||||
updateAllLines = not (startScreenRow? and endScreenRow?)
|
||||
updateAllLines |= endScreenRow <= @firstScreenRow or startScreenRow >= @lastScreenRow
|
||||
|
||||
for change in changes
|
||||
# When there is a change to the bufferRow -> screenRow map (i.e. a fold),
|
||||
# then rerender everything.
|
||||
if (change.screenDelta or change.bufferDelta) and change.screenDelta != change.bufferDelta
|
||||
updateAllLines = true
|
||||
break
|
||||
unless updateAllLines
|
||||
minChangeStartScreenRow = null
|
||||
for change in changes
|
||||
# When there is a change to the bufferRow -> screenRow map (i.e. a fold),
|
||||
# then rerender everything.
|
||||
if (change.screenDelta or change.bufferDelta) and change.screenDelta != change.bufferDelta
|
||||
updateAllLines = true
|
||||
break
|
||||
else if change.screenDelta or change.bufferDelta
|
||||
minChangeStartScreenRow = Math.min(change.start, minChangeStartScreenRow)
|
||||
|
||||
if minChangeStartScreenRow? and not updateAllLines
|
||||
# Need to rerender when changes are before a fold
|
||||
for screenRow in [minChangeStartScreenRow...endScreenRow]
|
||||
if @getEditor().isFoldedAtScreenRow(screenRow)
|
||||
updateAllLines = true
|
||||
break
|
||||
|
||||
if updateAllLines
|
||||
@lineNumbers[0].innerHTML = @buildLineElementsHtml(startScreenRow, endScreenRow)
|
||||
|
Loading…
Reference in New Issue
Block a user