diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index d77844015..426eb3129 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -88,6 +88,8 @@ describe "TextEditor", -> it "returns a different edit session with the same initial state", -> editor.setSelectedBufferRange([[1, 2], [3, 4]]) editor.addSelectionForBufferRange([[5, 6], [7, 8]], reversed: true) + editor.firstVisibleScreenRow = 5 + editor.firstVisibleScreenColumn = 5 editor.foldBufferRow(4) expect(editor.isFoldedAtBufferRow(4)).toBeTruthy() @@ -95,6 +97,8 @@ describe "TextEditor", -> expect(editor2.id).not.toBe editor.id expect(editor2.getSelectedBufferRanges()).toEqual editor.getSelectedBufferRanges() expect(editor2.getSelections()[1].isReversed()).toBeTruthy() + expect(editor2.getFirstVisibleScreenRow()).toBe 5 + expect(editor2.getFirstVisibleScreenColumn()).toBe 5 expect(editor2.isFoldedAtBufferRow(4)).toBeTruthy() # editor2 can now diverge from its origin edit session diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 0658d1d23..2ba45a3ba 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -497,6 +497,7 @@ class TextEditor extends Model newEditor = new TextEditor({ @buffer, displayBuffer, selectionsMarkerLayer, @tabLength, softTabs, suppressCursorCreation: true, @config, @notificationManager, @packageManager, + @firstVisibleScreenRow, @firstVisibleScreenColumn, @clipboard, @viewRegistry, @grammarRegistry, @project, @assert, @applicationDelegate }) newEditor