Fix issue in jumping to next bookmark

This commit is contained in:
Ben Ogle
2013-07-22 15:15:01 -07:00
parent 77e12e3658
commit 173c47f780
2 changed files with 11 additions and 1 deletions

View File

@@ -79,7 +79,7 @@ class BookmarksView
bookmarkIndex = _.sortedIndex markers, bufferRow, (marker) ->
if marker.getBufferRange then marker.getBufferRange().start.row else marker
bookmarkIndex++ if markers[bookmarkIndex].getBufferRange().start.row == bufferRow
bookmarkIndex++ if markers[bookmarkIndex] and markers[bookmarkIndex].getBufferRange().start.row == bufferRow
bookmarkIndex = 0 if bookmarkIndex >= markers.length
markers[bookmarkIndex]

View File

@@ -115,6 +115,11 @@ describe "Bookmarks package", ->
editor.trigger 'bookmarks:jump-to-next-bookmark'
expect(editSession.getCursor().getBufferPosition()).toEqual [2, 0]
editSession.setCursorBufferPosition([11, 0])
editor.trigger 'bookmarks:jump-to-next-bookmark'
expect(editSession.getCursor().getBufferPosition()).toEqual [2, 0]
it "jump-to-previous-bookmark finds previous bookmark", ->
editSession.setCursorBufferPosition([0, 0])
@@ -126,3 +131,8 @@ describe "Bookmarks package", ->
editor.trigger 'bookmarks:jump-to-previous-bookmark'
expect(editSession.getCursor().getBufferPosition()).toEqual [10, 0]
editSession.setCursorBufferPosition([11, 0])
editor.trigger 'bookmarks:jump-to-previous-bookmark'
expect(editSession.getCursor().getBufferPosition()).toEqual [10, 0]