From d7fabc5a5808d334819bf48dc1b9284764934a0a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 09:38:42 -0800 Subject: [PATCH 1/3] Map cmd-_ to window:decrease-font-size Makes it consistent with increase-font-size having two keybindings --- keymaps/darwin.cson | 1 + keymaps/win32.cson | 1 + 2 files changed, 2 insertions(+) diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index c93079efa..32508b7a2 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -68,6 +68,7 @@ 'cmd-=': 'window:increase-font-size' 'cmd-+': 'window:increase-font-size' 'cmd--': 'window:decrease-font-size' + 'cmd-_': 'window:decrease-font-size' 'cmd-k up': 'pane:split-up' # Atom Specific 'cmd-k down': 'pane:split-down' # Atom Specific diff --git a/keymaps/win32.cson b/keymaps/win32.cson index 9c78e3622..4a0cc96d3 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -40,6 +40,7 @@ 'ctrl-=': 'window:increase-font-size' 'ctrl-+': 'window:increase-font-size' 'ctrl--': 'window:decrease-font-size' + 'ctrl-_': 'window:decrease-font-size' 'ctrl-k up': 'pane:split-up' # Atom Specific 'ctrl-k down': 'pane:split-down' # Atom Specific From dda412d5ec38a9cb27402ce3e6f17a3cda8d03b0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 09:58:40 -0800 Subject: [PATCH 2/3] Add window:reset-font-size command --- keymaps/darwin.cson | 1 + keymaps/win32.cson | 1 + spec/config-spec.coffee | 13 +++++++++++++ src/config.coffee | 8 ++++++++ src/workspace-view.coffee | 1 + src/workspace.coffee | 3 +++ 6 files changed, 27 insertions(+) diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index 32508b7a2..307a023df 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -69,6 +69,7 @@ 'cmd-+': 'window:increase-font-size' 'cmd--': 'window:decrease-font-size' 'cmd-_': 'window:decrease-font-size' + 'cmd-0': 'window:reset-font-size' 'cmd-k up': 'pane:split-up' # Atom Specific 'cmd-k down': 'pane:split-down' # Atom Specific diff --git a/keymaps/win32.cson b/keymaps/win32.cson index 4a0cc96d3..e11d4c2f2 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -41,6 +41,7 @@ 'ctrl-+': 'window:increase-font-size' 'ctrl--': 'window:decrease-font-size' 'ctrl-_': 'window:decrease-font-size' + 'ctrl-0': 'window:reset-font-size' 'ctrl-k up': 'pane:split-up' # Atom Specific 'ctrl-k down': 'pane:split-down' # Atom Specific diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 9f8afa408..02ef6d6d8 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -63,6 +63,19 @@ describe "Config", -> atom.config.toggle('foo.a') expect(atom.config.get('foo.a')).toBe false + describe ".restoreDefault(keyPath)", -> + it "sets the value of the key path to its default", -> + atom.config.setDefaults('a', b: 3) + atom.config.set('a.b', 4) + expect(atom.config.get('a.b')).toBe 4 + atom.config.restoreDefault('a.b') + expect(atom.config.get('a.b')).toBe 3 + + atom.config.set('a.c', 5) + expect(atom.config.get('a.c')).toBe 5 + atom.config.restoreDefault('a.c') + expect(atom.config.get('a.c')).toBeUndefined() + describe ".pushAtKeyPath(keyPath, value)", -> it "pushes the given value to the array at the key path and updates observers", -> atom.config.set("foo.bar.baz", ["a"]) diff --git a/src/config.coffee b/src/config.coffee index 7896fa795..775d051ee 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -150,6 +150,14 @@ class Config toggle: (keyPath) -> @set(keyPath, !@get(keyPath)) + # Public: Restore the key path to its default value. + # + # keyPath - The {String} name of the key. + # + # Returns the new value. + restoreDefault: (keyPath) -> + @set(keyPath, _.valueForKeyPath(@defaultSettings, keyPath)) + # Public: Push the value to the array at the key path. # # keyPath - The {String} key path. diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 9b66cae78..acf631a81 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -117,6 +117,7 @@ class WorkspaceView extends View @command 'window:run-package-specs', => ipc.sendChannel('run-package-specs', path.join(atom.project.getPath(), 'spec')) @command 'window:increase-font-size', => @increaseFontSize() @command 'window:decrease-font-size', => @decreaseFontSize() + @command 'window:reset-font-size', => @model.resetFontSize() @command 'window:focus-next-pane', => @focusNextPane() @command 'window:focus-previous-pane', => @focusPreviousPane() diff --git a/src/workspace.coffee b/src/workspace.coffee index c123131e7..945ee9b6c 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -167,6 +167,9 @@ class Workspace extends Model fontSize = atom.config.get("editor.fontSize") atom.config.set("editor.fontSize", fontSize - 1) if fontSize > 1 + resetFontSize: -> + atom.config.restoreDefault("editor.fontSize") + # Removes the item's uri from the list of potential items to reopen. itemOpened: (item) -> if uri = item.getUri?() From 211d222291528521ba2bc5ec2e34c6b9bf06a3ab Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 11 Feb 2014 10:00:13 -0800 Subject: [PATCH 3/3] Remove auto-indent conflict with increase zoom --- keymaps/darwin.cson | 1 - keymaps/win32.cson | 1 - 2 files changed, 2 deletions(-) diff --git a/keymaps/darwin.cson b/keymaps/darwin.cson index 307a023df..750a1468f 100644 --- a/keymaps/darwin.cson +++ b/keymaps/darwin.cson @@ -124,7 +124,6 @@ 'alt-cmd-z': 'editor:checkout-head-revision' 'cmd-<': 'editor:scroll-to-cursor' 'alt-cmd-ctrl-f': 'editor:fold-selection' - 'cmd-=': 'editor:auto-indent' # Sublime Parity 'cmd-enter': 'editor:newline-below' diff --git a/keymaps/win32.cson b/keymaps/win32.cson index e11d4c2f2..ca306414e 100644 --- a/keymaps/win32.cson +++ b/keymaps/win32.cson @@ -71,7 +71,6 @@ 'alt-ctrl-z': 'editor:checkout-head-revision' 'ctrl-<': 'editor:scroll-to-cursor' 'alt-ctrl-f': 'editor:fold-selection' - 'ctrl-=': 'editor:auto-indent' # Sublime Parity 'ctrl-enter': 'editor:newline-below'