Skip to content

Commit

Permalink
prevent extra cursor appearing at end of file
Browse files Browse the repository at this point in the history
Reference:
#73
  • Loading branch information
Icehunter committed Sep 3, 2014
1 parent 372bc34 commit e599387
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/beautify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,19 @@ getUserHome = ->
getCursors = (editor) ->
cursors = editor.getCursors()
posArray = []
idx = 0

while idx < cursors.length
cursor = cursors[idx]
for cursor in cursors
bufferPosition = cursor.getBufferPosition()
posArray.push [
bufferPosition.row
bufferPosition.column
]
idx++
posArray

setCursors = (editor, posArray) ->
idx = 0
len = posArray.length
# console.log "setCursors: #{posArray}"
while idx < len
# console.log idx
bufferPosition = posArray[idx]
idx++
# console.log bufferPosition
if idx is 0
for bufferPosition, i in posArray
if i is 0
editor.setCursorBufferPosition bufferPosition
continue
editor.addCursorAtBufferPosition bufferPosition
Expand Down

0 comments on commit e599387

Please sign in to comment.