From 13183639b66f7dcd4563546926f980d01c995cd3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki & Nathan Sobo Date: Tue, 5 Feb 2013 17:06:56 -0700 Subject: [PATCH] Ensure the cursor becomes visible when the selection is emptied (Even if the cursor doesn't move) --- spec/app/edit-session-spec.coffee | 1 + src/app/cursor.coffee | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 9fe4c5b87..e0c161796 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -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", -> diff --git a/src/app/cursor.coffee b/src/app/cursor.coffee index 5c9b9091c..5708d4bf7 100644 --- a/src/app/cursor.coffee +++ b/src/app/cursor.coffee @@ -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 =