From db0a39679c8ddeece42da807d18681976f977541 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 12 Dec 2012 13:55:27 -0800 Subject: [PATCH] Remove `showInvisibles` constructor param on Editor And remove `showInvisibles` state from the `RootView` now that it's managed via `config`. --- src/app/editor.coffee | 6 +++--- src/app/root-view.coffee | 12 ++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/app/editor.coffee b/src/app/editor.coffee index fa3ca05e2..02da724e1 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -50,12 +50,12 @@ class Editor extends View @deserialize: (state, rootView) -> editSessions = state.editSessions.map (state) -> EditSession.deserialize(state, rootView.project) - editor = new Editor(editSession: editSessions[state.activeEditSessionIndex], mini: state.mini, showInvisibles: rootView.showInvisibles) + editor = new Editor(editSession: editSessions[state.activeEditSessionIndex], mini: state.mini) editor.editSessions = editSessions editor.isFocused = state.isFocused editor - initialize: ({editSession, @mini, @showInvisibles} = {}) -> + initialize: ({editSession, @mini} = {}) -> requireStylesheet 'editor.css' @id = Editor.idCounter++ @@ -622,7 +622,7 @@ class Editor extends View @requestDisplayUpdate() newSplitEditor: -> - new Editor { editSession: @activeEditSession.copy(), @showInvisibles } + new Editor { editSession: @activeEditSession.copy() } splitLeft: -> @pane()?.splitLeft(@newSplitEditor()).wrappedView diff --git a/src/app/root-view.coffee b/src/app/root-view.coffee index d8b7c66c3..7969fec11 100644 --- a/src/app/root-view.coffee +++ b/src/app/root-view.coffee @@ -30,7 +30,6 @@ class RootView extends View extensions: null extensionStates: null fontSize: 20 - showInvisibles: false invisibles: null title: null @@ -88,7 +87,9 @@ class RootView extends View @command 'window:decrease-font-size', => @setFontSize(@getFontSize() - 1) @command 'window:focus-next-pane', => @focusNextPane() @command 'window:save-all', => @saveAll() - @command 'window:toggle-invisibles', => @setShowInvisibles(not @showInvisibles) + @command 'window:toggle-invisibles', => + config.editor.showInvisibles = not config.editor.showInvisibles + config.update() @command 'window:toggle-ignored-files', => @toggleIgnoredFiles() afterAttach: (onDom) -> @@ -130,7 +131,7 @@ class RootView extends View unless editSession = @openInExistingEditor(path, allowActiveEditorChange, changeFocus) editSession = @project.buildEditSessionForPath(path) - editor = new Editor({editSession, @showInvisibles}) + editor = new Editor({editSession}) pane = new Pane(editor) @panes.append(pane) if changeFocus @@ -197,11 +198,6 @@ class RootView extends View updateWindowTitle: -> document.title = @title - setShowInvisibles: (showInvisibles) -> - return if @showInvisibles == showInvisibles - @showInvisibles = showInvisibles - editor.setShowInvisibles(@showInvisibles) for editor in @getEditors() - toggleIgnoredFiles: -> @project.toggleIgnoredFiles()