diff --git a/.travis.yml b/.travis.yml index 71accd347..790259016 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ install: - source /tmp/.nvm/nvm.sh - nvm install $NODE_VERSION - nvm use --delete-prefix $NODE_VERSION - - npm install -g npm + - npm install -g npm@5.1.0 - script/build --create-debian-package --create-rpm-package --compress-artifacts script: diff --git a/appveyor.yml b/appveyor.yml index 11ab7b3ba..30b321e35 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,7 +20,7 @@ environment: ATOM_DEV_RESOURCE_PATH: c:\projects\atom matrix: - - NODE_VERSION: 6.8.0 + - NODE_VERSION: 6.9.4 matrix: fast_finish: true @@ -28,7 +28,7 @@ matrix: install: - SET PATH=C:\Program Files\Atom\resources\cli;%PATH% - ps: Install-Product node $env:NODE_VERSION $env:PLATFORM - - npm install -g npm + - npm install -g npm@5.1.0 build_script: - IF NOT EXIST C:\sqtemp MKDIR C:\sqtemp diff --git a/circle.yml b/circle.yml index 5890c45e9..34ff7e2f8 100644 --- a/circle.yml +++ b/circle.yml @@ -18,7 +18,7 @@ dependencies: - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash - nvm install 6.9.4 - nvm use 6.9.4 - - npm install -g npm + - npm install -g npm@5.1.0 override: - script/build --code-sign --compress-artifacts diff --git a/package.json b/package.json index 7e4512d86..3e9392b31 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "about": "1.7.6", "archive-view": "0.63.3", "autocomplete-atom-api": "0.10.2", - "autocomplete-css": "0.16.2", + "autocomplete-css": "0.16.3", "autocomplete-html": "0.8.0", "autocomplete-plus": "2.35.7", "autocomplete-snippets": "1.11.0", @@ -102,7 +102,7 @@ "dev-live-reload": "0.47.1", "encoding-selector": "0.23.4", "exception-reporting": "0.41.4", - "find-and-replace": "0.209.1", + "find-and-replace": "0.209.2", "fuzzy-finder": "1.5.8", "github": "0.3.7", "git-diff": "1.3.6", diff --git a/script/package.json b/script/package.json index e5c09c286..9f1f36a4d 100644 --- a/script/package.json +++ b/script/package.json @@ -22,7 +22,7 @@ "minidump": "0.9.0", "mkdirp": "0.5.1", "normalize-package-data": "2.3.5", - "npm": "3.10.5", + "npm": "5.1.0", "passwd-user": "2.1.0", "pegjs": "0.9.0", "runas": "3.1.1", diff --git a/spec/text-editor-element-spec.js b/spec/text-editor-element-spec.js index c92c6f144..684d160a8 100644 --- a/spec/text-editor-element-spec.js +++ b/spec/text-editor-element-spec.js @@ -9,6 +9,10 @@ describe('TextEditorElement', () => { beforeEach(() => { jasmineContent = document.body.querySelector('#jasmine-content') + // Force scrollbars to be visible regardless of local system configuration + const scrollbarStyle = document.createElement('style') + scrollbarStyle.textContent = '::-webkit-scrollbar { -webkit-appearance: none }' + jasmine.attachToDOM(scrollbarStyle) }) function buildTextEditorElement (options = {}) { @@ -201,6 +205,33 @@ describe('TextEditorElement', () => { }) }) + describe('::setModel', () => { + describe('when the element does not have an editor yet', () => { + it('uses the supplied one', () => { + const element = buildTextEditorElement({attach: false}) + const editor = new TextEditor() + element.setModel(editor) + jasmine.attachToDOM(element) + expect(editor.element).toBe(element) + expect(element.getModel()).toBe(editor) + }) + }) + + describe('when the element already has an editor', () => { + it('unbinds it and then swaps it with the supplied one', async () => { + const element = buildTextEditorElement({attach: true}) + const previousEditor = element.getModel() + expect(previousEditor.element).toBe(element) + + const newEditor = new TextEditor() + element.setModel(newEditor) + expect(previousEditor.element).not.toBe(element) + expect(newEditor.element).toBe(element) + expect(element.getModel()).toBe(newEditor) + }) + }) + }) + describe('::onDidAttach and ::onDidDetach', () => it('invokes callbacks when the element is attached and detached', () => { const element = buildTextEditorElement({attach: false}) diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index f35ed39d8..b37acddd1 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -938,8 +938,8 @@ class AtomEnvironment extends Model "Would you like to add the #{nouns} to this window, permanently discarding the saved state, " + "or open the #{nouns} in a new window, restoring the saved state?" buttons: [ - 'Open in new window and recover state' - 'Add to this window and discard state' + '&Open in new window and recover state' + '&Add to this window and discard state' ] if btn is 0 @open diff --git a/src/main-process/atom-window.coffee b/src/main-process/atom-window.coffee index b0b516b10..f20239e66 100644 --- a/src/main-process/atom-window.coffee +++ b/src/main-process/atom-window.coffee @@ -54,14 +54,14 @@ class AtomWindow @browserWindow = new BrowserWindow(options) @handleEvents() - loadSettings = Object.assign({}, settings) - loadSettings.appVersion = app.getVersion() - loadSettings.resourcePath = @resourcePath - loadSettings.devMode ?= false - loadSettings.safeMode ?= false - loadSettings.atomHome = process.env.ATOM_HOME - loadSettings.clearWindowState ?= false - loadSettings.initialPaths ?= + @loadSettings = Object.assign({}, settings) + @loadSettings.appVersion = app.getVersion() + @loadSettings.resourcePath = @resourcePath + @loadSettings.devMode ?= false + @loadSettings.safeMode ?= false + @loadSettings.atomHome = process.env.ATOM_HOME + @loadSettings.clearWindowState ?= false + @loadSettings.initialPaths ?= for {pathToOpen} in locationsToOpen when pathToOpen stat = fs.statSyncNoException(pathToOpen) or null if stat?.isDirectory() @@ -72,17 +72,17 @@ class AtomWindow parentDirectory else pathToOpen - loadSettings.initialPaths.sort() + @loadSettings.initialPaths.sort() # Only send to the first non-spec window created if @constructor.includeShellLoadTime and not @isSpec @constructor.includeShellLoadTime = false - loadSettings.shellLoadTime ?= Date.now() - global.shellStartTime + @loadSettings.shellLoadTime ?= Date.now() - global.shellStartTime - @representedDirectoryPaths = loadSettings.initialPaths - @env = loadSettings.env if loadSettings.env? + @representedDirectoryPaths = @loadSettings.initialPaths + @env = @loadSettings.env if @loadSettings.env? - @browserWindow.loadSettingsJSON = JSON.stringify(loadSettings) + @browserWindow.loadSettingsJSON = JSON.stringify(@loadSettings) @browserWindow.on 'window:loaded', => @disableZoom() @@ -309,6 +309,8 @@ class AtomWindow setRepresentedDirectoryPaths: (@representedDirectoryPaths) -> @representedDirectoryPaths.sort() + @loadSettings.initialPaths = @representedDirectoryPaths + @browserWindow.loadSettingsJSON = JSON.stringify(@loadSettings) @atomApplication.saveState() copy: -> @browserWindow.copy() diff --git a/src/pane.coffee b/src/pane.coffee index 3dde9678f..1fefa361b 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -662,7 +662,7 @@ class Pane chosen = @applicationDelegate.confirm message: message detailedMessage: "Your changes will be lost if you close this item without saving." - buttons: [saveButtonText, "Cancel", "Don't Save"] + buttons: [saveButtonText, "Cancel", "&Don't Save"] switch chosen when 0 new Promise (resolve) -> diff --git a/src/text-editor-component.js b/src/text-editor-component.js index 037e45462..a93cbabba 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -174,6 +174,10 @@ class TextEditorComponent { } update (props) { + if (props.model !== this.props.model) { + this.props.model.component = null + props.model.component = this + } this.props = props this.scheduleUpdate() }