diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index 721310d35..a6cd08993 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -225,6 +225,26 @@ describe "Workspace", -> expect(workspace.paneContainer.root.children[0]).toBe pane1 expect(workspace.paneContainer.root.children[1]).toBe pane4 + describe "when an initialLine and initialColumn are specified", -> + it "moves the cursor to the indicated location", -> + waitsForPromise -> + workspace.open('a', initialLine: 1, initialColumn: 5) + + runs -> + expect(workspace.getActiveTextEditor().getCursorBufferPosition()).toEqual [1, 5] + + waitsForPromise -> + workspace.open('a', initialLine: 2, initialColumn: 4) + + runs -> + expect(workspace.getActiveTextEditor().getCursorBufferPosition()).toEqual [2, 4] + + waitsForPromise -> + workspace.open('a', initialLine: 0, initialColumn: 0) + + runs -> + expect(workspace.getActiveTextEditor().getCursorBufferPosition()).toEqual [0, 0] + describe "when the file is over 2MB", -> it "opens the editor with largeFileMode: true", -> spyOn(fs, 'getSizeSync').andReturn 2 * 1048577 # 2MB diff --git a/src/workspace.coffee b/src/workspace.coffee index 6c3a0d6f9..ee0df255f 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -472,7 +472,7 @@ class Workspace extends Model initialLine = options.initialLine if Number.isFinite(options.initialColumn) initialColumn = options.initialColumn - if initialLine > 0 or initialColumn > 0 or options.initialLine? or options.initialColumn? + if initialLine >= 0 or initialColumn >= 0 item.setCursorBufferPosition?([initialLine, initialColumn]) index = pane.getActiveItemIndex()