Preserve line number for mouseWheelScreenRow in a sane way

What we were doing before made no sense.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo
2015-02-03 14:45:58 -07:00
parent 78b8039384
commit 20a95269c9

View File

@@ -267,11 +267,11 @@ class TextEditorPresenter
visibleLineNumberIds[id] = true
if @mouseWheelScreenRow?
screenRow = @mouseWheelScreenRow
top = screenRow * @lineHeight
bufferRow = @model.bufferRowForScreenRow(screenRow)
@state.gutter.lineNumbers[id] = {screenRow, bufferRow, top}
visibleLineNumberIds[bufferRow] = true
bufferRow = @model.bufferRowForScreenRow(@mouseWheelScreenRow)
wrapCount = @mouseWheelScreenRow - @model.screenRowForBufferRow(bufferRow)
id = bufferRow
id += '-' + wrapCount if wrapCount > 0
visibleLineNumberIds[id] = true
for id of @state.gutter.lineNumbers
delete @state.gutter.lineNumbers[id] unless visibleLineNumberIds[id]