From 808559b25fb58789ee2dd693467e6ecb0220e1be Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Thu, 20 Dec 2012 10:02:09 -0800 Subject: [PATCH 1/6] default-config is no longer used --- benchmark/benchmark-suite.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/benchmark/benchmark-suite.coffee b/benchmark/benchmark-suite.coffee index 8e809368e..46af80571 100644 --- a/benchmark/benchmark-suite.coffee +++ b/benchmark/benchmark-suite.coffee @@ -14,7 +14,6 @@ describe "editor.", -> rootView.width(1024) rootView.height(768) - require fs.join(config.configDirPath, "default-config") rootView.open() # open blank editor editor = rootView.getActiveEditor() From 39f5ce6087719923b7ee5b97d841aaa5de2788e3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 20 Dec 2012 13:08:13 -0800 Subject: [PATCH 2/6] Activate running Atom when invoked with no path --- native/main_mac.mm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/native/main_mac.mm b/native/main_mac.mm index c16dfb83b..8ccb8f887 100644 --- a/native/main_mac.mm +++ b/native/main_mac.mm @@ -7,6 +7,7 @@ void sendPathToMainProcessAndExit(int fd, NSString *socketPath, NSDictionary *arguments); void handleBeingOpenedAgain(int argc, char* argv[]); void listenForPathToOpen(int fd, NSString *socketPath); +void activateOpenApp(); BOOL isAppAlreadyOpen(); int main(int argc, char* argv[]) { @@ -58,6 +59,8 @@ void sendPathToMainProcessAndExit(int fd, NSString *socketPath, NSDictionary *ar perror("Error: Failed to sending path to main Atom process"); exit(1); } + } else { + activateOpenApp(); } exit(0); } @@ -101,6 +104,17 @@ void listenForPathToOpen(int fd, NSString *socketPath) { } } +void activateOpenApp() { + for (NSRunningApplication *app in [[NSWorkspace sharedWorkspace] runningApplications]) { + BOOL hasSameBundleId = [app.bundleIdentifier isEqualToString:[[NSBundle mainBundle] bundleIdentifier]]; + BOOL hasSameProcessesId = app.processIdentifier == [[NSProcessInfo processInfo] processIdentifier]; + if (hasSameBundleId && !hasSameProcessesId) { + [app activateWithOptions:NSApplicationActivateIgnoringOtherApps]; + return; + } + } +} + BOOL isAppAlreadyOpen() { for (NSRunningApplication *app in [[NSWorkspace sharedWorkspace] runningApplications]) { BOOL hasSameBundleId = [app.bundleIdentifier isEqualToString:[[NSBundle mainBundle] bundleIdentifier]]; From 628d22de0adedb00e4fa9edca43a940c729b5fbc Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 20 Dec 2012 14:50:48 -0800 Subject: [PATCH 3/6] Use tab invisible that is available in Inconsolata Previously a non-Inconsolata character was being used which caused alignment issues with selections and the cursor Also switch values in editor.coffee to use codes so they can be viewed in any font. --- src/app/editor.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 9089433fb..774a3142a 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -287,9 +287,9 @@ class Editor extends View setInvisibles: (@invisibles={}) -> _.defaults @invisibles, - eol: '¬', - space: '•', - tab: '▸' + eol: '\u00ac', + space: '\u2022', + tab: '\u00bb' @resetDisplay() checkoutHead: -> @getBuffer().checkoutHead() From 3cd8a3304efb3df0e66d472c546f1ee6aaaa845b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 20 Dec 2012 15:07:11 -0800 Subject: [PATCH 4/6] Use values directly from editor in invisibles spec --- spec/app/editor-spec.coffee | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index eb954ba1b..693e3b93e 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -1548,7 +1548,7 @@ describe "Editor", -> expect(editor.find('.line:eq(0)').outerHeight()).toBe editor.find('.line:eq(1)').outerHeight() describe "when config.editor.showInvisibles is set to true", -> - it "displays spaces as •, tabs as ▸ and newlines as ¬ when true", -> + it "displays spaces, tabs, and newlines using visible non-empty values", -> editor.setText " a line with tabs\tand spaces " editor.attachToDom() @@ -1556,12 +1556,18 @@ describe "Editor", -> expect(editor.renderedLines.find('.line').text()).toBe " a line with tabs and spaces " config.set("editor.showInvisibles", true) - expect(editor.renderedLines.find('.line').text()).toBe "•a line with tabs▸ and spaces•¬" + space = editor.invisibles?.space + expect(space).toBeTruthy() + tab = editor.invisibles?.tab + expect(tab).toBeTruthy() + eol = editor.invisibles?.eol + expect(eol).toBeTruthy() + expect(editor.renderedLines.find('.line').text()).toBe "#{space}a line with tabs#{tab} and spaces#{space}#{eol}" config.set("editor.showInvisibles", false) expect(editor.renderedLines.find('.line').text()).toBe " a line with tabs and spaces " - it "displays newlines(¬) as their own token outside of the other tokens scope", -> + it "displays newlines as their own token outside of the other tokens scope", -> editor.setShowInvisibles(true) editor.attachToDom() editor.setText "var" From 7efaf084a0b3dbf28e454e510c873b235dd0e77c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 20 Dec 2012 15:42:38 -0800 Subject: [PATCH 5/6] Use editor settings for creating comparison string showing invisibles --- spec/app/root-view-spec.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/app/root-view-spec.coffee b/spec/app/root-view-spec.coffee index cd2fe8588..3043f2731 100644 --- a/spec/app/root-view-spec.coffee +++ b/spec/app/root-view-spec.coffee @@ -698,12 +698,14 @@ describe "RootView", -> expect(rightEditor.find(".line:first").text()).toBe " " expect(leftEditor.find(".line:first").text()).toBe " " + withInvisiblesShowing = "#{rightEditor.invisibles.space}#{rightEditor.invisibles.tab} #{rightEditor.invisibles.space}#{rightEditor.invisibles.eol}" + rootView.trigger "window:toggle-invisibles" - expect(rightEditor.find(".line:first").text()).toBe "•▸ •¬" - expect(leftEditor.find(".line:first").text()).toBe "•▸ •¬" + expect(rightEditor.find(".line:first").text()).toBe withInvisiblesShowing + expect(leftEditor.find(".line:first").text()).toBe withInvisiblesShowing lowerLeftEditor = leftEditor.splitDown() - expect(lowerLeftEditor.find(".line:first").text()).toBe "•▸ •¬" + expect(lowerLeftEditor.find(".line:first").text()).toBe withInvisiblesShowing rootView.trigger "window:toggle-invisibles" expect(rightEditor.find(".line:first").text()).toBe " " From 880edcd408db4c7ec207f94989e016f73f3e5d76 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 20 Dec 2012 22:16:25 -0700 Subject: [PATCH 6/6] Increase `waitsFor` timeout in attempt to address intermittent failure --- spec/spec-helper.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index beb71d295..33a372f02 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -72,7 +72,7 @@ jasmine.unspy = (object, methodName) -> throw new Error("Not a spy") unless object[methodName].originalValue? object[methodName] = object[methodName].originalValue -jasmine.getEnv().defaultTimeoutInterval = 200 +jasmine.getEnv().defaultTimeoutInterval = 500 window.keyIdentifierForKey = (key) -> if key.length > 1 # named key