From 12b59cf610e08aefa22872ef76eaa8fce3ccb6d0 Mon Sep 17 00:00:00 2001 From: Machiste Quintana Date: Tue, 28 Apr 2015 05:49:22 -0400 Subject: [PATCH] Only reset font size if font size has been changed --- spec/workspace-spec.coffee | 8 ++++++++ src/workspace.coffee | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index 7d8ea03b3..61da334bb 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -425,6 +425,7 @@ describe "Workspace", -> expect(atom.config.get('editor.fontSize')).toBe 1 workspace.decreaseFontSize() expect(atom.config.get('editor.fontSize')).toBe 1 + describe "::resetFontSize()", -> it "resets the font size to the window's starting font size", -> originalFontSize = 6 @@ -439,6 +440,13 @@ describe "Workspace", -> workspace.resetFontSize() expect(atom.config.get('editor.fontSize')).toBe originalFontSize + it "does nothing if the font size has not been changed", -> + originalFontSize = 6 + + atom.config.set('editor.fontSize', originalFontSize) + workspace.resetFontSize() + expect(atom.config.get('editor.fontSize')).toBe originalFontSize + describe "::openLicense()", -> it "opens the license as plain-text in a buffer", -> waitsForPromise -> workspace.openLicense() diff --git a/src/workspace.coffee b/src/workspace.coffee index 7d460add0..2f70e4316 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -623,7 +623,8 @@ class Workspace extends Model # Restore to the window's original editor font size. resetFontSize: -> - atom.config.set("editor.fontSize", @originalFontSize) + if @originalFontSize + atom.config.set("editor.fontSize", @originalFontSize) # Removes the item's uri from the list of potential items to reopen. itemOpened: (item) ->