From 0300ce263bdeb79f62ff7f9d6e09a589fa794f22 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Thu, 10 Nov 2011 16:47:54 -0800 Subject: [PATCH] window open is working cool --- src/atom/document.coffee | 3 ++- src/atom/editor.coffee | 20 +++++++++++--------- src/atom/window.coffee | 1 - 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/atom/document.coffee b/src/atom/document.coffee index 067036fef..e2f8b0f4e 100644 --- a/src/atom/document.coffee +++ b/src/atom/document.coffee @@ -23,7 +23,8 @@ class Document extends Pane @path = path if path atom.trigger 'document:load', this - open: -> + open: (path) -> + @constructor is Document.handler path close: -> diff --git a/src/atom/editor.coffee b/src/atom/editor.coffee index bdb9e0d78..bde2156e8 100644 --- a/src/atom/editor.coffee +++ b/src/atom/editor.coffee @@ -78,15 +78,17 @@ class Editor extends Document null open: (path) -> - if Editor is Document.handler path - @path = path - @dirty = false - @ace.getSession().setValue code = fs.read @path - @ace.getSession().setUndoManager new UndoManager - mode = @modeForPath() - @ace.getSession().setMode new mode if mode - atom.trigger 'editor:load', this - true + return false if not super + return false if @path + + @path = path + @dirty = false + @ace.getSession().setValue code = fs.read @path + @ace.getSession().setUndoManager new UndoManager + mode = @modeForPath() + @ace.getSession().setMode new mode if mode + atom.trigger 'editor:load', this + true close: -> if @dirty diff --git a/src/atom/window.coffee b/src/atom/window.coffee index 917c70c89..2a2ecf257 100644 --- a/src/atom/window.coffee +++ b/src/atom/window.coffee @@ -10,7 +10,6 @@ windowAdditions = startup: -> @path = atom.path - $atomController.window.makeKeyWindow shutdown: ->