From 8e107359f3fbd4405825ff4678367543f4752f2a Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 24 Feb 2012 22:08:34 -0700 Subject: [PATCH] Changes correctly update cursor position when there are folds --- spec/atom/editor-spec.coffee | 6 ++++++ src/atom/cursor.coffee | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/atom/editor-spec.coffee b/spec/atom/editor-spec.coffee index 1a75184bb..e2b71be22 100644 --- a/spec/atom/editor-spec.coffee +++ b/spec/atom/editor-spec.coffee @@ -745,3 +745,9 @@ describe "Editor", -> editor.setCursorScreenPosition([9, 2]) expect(editor.getCursorScreenPosition()).toEqual [9, 2] + + buffer.insert([9, 4], 'x') + expect(editor.getCursorScreenPosition()).toEqual [6, 5] + expect(editor.getCursorBufferPosition()).toEqual [9, 5] + + diff --git a/src/atom/cursor.coffee b/src/atom/cursor.coffee index 2316eee67..2674d5299 100644 --- a/src/atom/cursor.coffee +++ b/src/atom/cursor.coffee @@ -13,7 +13,7 @@ class Cursor extends View @one 'attach', => @updateAppearance() bufferChanged: (e) -> - @setScreenPosition(e.newRange.end) + @setBufferPosition(e.newRange.end) setScreenPosition: (position) -> position = Point.fromObject(position)