Ensure the cursor becomes visible when the selection is emptied

(Even if the cursor doesn't move)
This commit is contained in:
Kevin Sawicki & Nathan Sobo
2013-02-05 17:06:56 -07:00
parent aaf22a9433
commit 13183639b6
2 changed files with 3 additions and 2 deletions

View File

@@ -1042,6 +1042,7 @@ describe "EditSession", ->
expect(line).toBe " var ort = function(items) {"
expect(editSession.getCursorScreenPosition()).toEqual {row: 1, column: 6}
expect(changeScreenRangeHandler).toHaveBeenCalled()
expect(editSession.getCursor().isVisible()).toBeTruthy()
describe "when the cursor is at the beginning of a line", ->
it "joins it with the line above", ->

View File

@@ -13,13 +13,13 @@ class Cursor
constructor: ({@editSession, @marker}) ->
@editSession.observeMarker @marker, (e) =>
@setVisible(@selection.isEmpty())
{oldHeadScreenPosition, newHeadScreenPosition} = e
{oldHeadBufferPosition, newHeadBufferPosition} = e
{bufferChanged} = e
return if oldHeadScreenPosition.isEqual(newHeadScreenPosition)
@setVisible(@selection.isEmpty())
@needsAutoscroll ?= @isLastCursor() and !bufferChanged
movedEvent =