From c258c2847eb2f7ba2c8ec2df36dc0107d2987010 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Wed, 7 Mar 2012 11:41:52 -0800 Subject: [PATCH] Fix bug introduced when I resolved a conflict resolution. --- spec/atom/editor-spec.coffee | 27 --------------------------- src/atom/cursor.coffee | 2 +- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/spec/atom/editor-spec.coffee b/spec/atom/editor-spec.coffee index e7416e1b3..cfb441360 100644 --- a/spec/atom/editor-spec.coffee +++ b/spec/atom/editor-spec.coffee @@ -380,33 +380,6 @@ describe "Editor", -> editor.setCursorScreenPosition([2, 5]) expect(editor.scrollLeft()).toBe 0 - describe "when soft-wrap is on", -> - beforeEach -> - editor.setSoftWrap(true) - - it "does not scroll the buffer", -> - editor.width(charWidth * 30) - - # moving right - editor.setCursorScreenPosition([2, 24]) - expect(editor.scrollLeft()).toBe 0 - - editor.setCursorScreenPosition([2, 25]) - expect(editor.scrollLeft()).toBe 0 - - editor.setCursorScreenPosition([2, 28]) - expect(editor.scrollLeft()).toBe 0 - - # moving left - editor.setCursorScreenPosition([2, 9]) - expect(editor.scrollLeft()).toBe 0 - - editor.setCursorScreenPosition([2, 8]) - expect(editor.scrollLeft()).toBe 0 - - editor.setCursorScreenPosition([2, 5]) - expect(editor.scrollLeft()).toBe 0 - describe "when left is pressed on the first column", -> describe "when there is a previous line", -> it "wraps to the end of the previous line", -> diff --git a/src/atom/cursor.coffee b/src/atom/cursor.coffee index 6aca92bce..888559f7c 100644 --- a/src/atom/cursor.coffee +++ b/src/atom/cursor.coffee @@ -130,7 +130,7 @@ class Cursor extends View autoScrollHorizontally: (position) -> return if @editor.softWrap - charsInView = @editor.width() / @width() + charsInView = @editor.lines.width() / @width() maxScrollMargin = Math.floor((charsInView - 1) / 2) scrollMargin = Math.min(@editor.hScrollMargin, maxScrollMargin) margin = scrollMargin * @width()