Skip to content
This repository was archived by the owner on Apr 6, 2018. It is now read-only.

Commit 1f99b6e

Browse files
committed
Fix critical degradation #785
1 parent 72b5896 commit 1f99b6e

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/motions/general-motions.coffee

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,22 @@ class MoveUpDown extends Motion
166166
direction: null
167167

168168
getScreenRowCount: (cursor) ->
169-
unless (@isLinewise() and @editor.isSoftWrapped())
170-
return 1
171-
else
172-
cursorBufferRow = cursor.getBufferRow()
173-
cursorLineBufferRange = [[cursorBufferRow, 0], [cursorBufferRow, Infinity]]
174-
cursorLineScreenRange = @editor.screenRangeForBufferRange(cursorLineBufferRange)
175-
cursorLineScreenRange.getRowCount()
169+
return 1 unless (@isLinewise() and @editor.isSoftWrapped())
170+
171+
cursorBufferRow = cursor.getBufferRow()
172+
cursorLineBufferRange = [[cursorBufferRow, 0], [cursorBufferRow, Infinity]]
173+
cursorLineScreenRange = @editor.screenRangeForBufferRange(cursorLineBufferRange)
174+
cursorLineScreenRange.getRowCount()
176175

177176
moveCursor: (cursor, count=1) ->
178177
_.times count, =>
179-
unless cursor.getScreenRow() is 0
180-
cursor["move#{@direction}"](@getScreenRowCount(cursor))
178+
screenRowCount = @getScreenRowCount(cursor)
179+
180+
if (@direction is 'Up') and not (cursor.getScreenRow() is 0)
181+
cursor.moveUp(screenRowCount)
182+
@ensureCursorIsWithinLine(cursor)
183+
else if (@direction is 'Down') and not (cursor.getScreenRow() is @editor.getLastScreenRow())
184+
cursor.moveDown(screenRowCount)
181185
@ensureCursorIsWithinLine(cursor)
182186

183187
class MoveUp extends MoveUpDown

0 commit comments

Comments
 (0)