diff --git a/CHANGELOG.md b/CHANGELOG.md index e36b3f59e..8823bd9cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1 @@ See https://atom.io/releases - -## 1.4.0 - -* Switching encoding is now fast also with large files. -* Fixed an issue where disabling and re-enabling a package caused custom keymaps to be overridden. -* Fixed restoring untitled editors on restart. The new behavior never prompts to save new/changed files when closing a window or quitting Atom. - -## 1.3.0 - -* The tree-view now sorts directory entries more naturally, in a locale-sensitive way. -* Lines can now be moved up and down with multiple cursors. -* Improved the performance of marker-dependent code paths such as spell-check and find and replace. -* Fixed copying and pasting in native input fields. -* By default, windows with no pane items are now closed via the `core:close` command. The previous behavior can be restored via the `Close Empty Windows` option in settings. -* Fixed an issue where characters were inserted when toggling the settings view on some keyboard layouts. -* Modules can now temporarily override `Error.prepareStackTrace`. There is also an `Error.prototype.getRawStack()` method if you just need access to the raw v8 trace structure. -* Fixed a problem that caused blurry fonts on monitors that have a slightly higher resolution than 96 DPI. diff --git a/menus/darwin.cson b/menus/darwin.cson index 52b7a5bc8..0195bde71 100644 --- a/menus/darwin.cson +++ b/menus/darwin.cson @@ -139,7 +139,6 @@ { label: 'View' submenu: [ - { label: 'Reload', command: 'window:reload' } { label: 'Toggle Full Screen', command: 'window:toggle-full-screen' } { label: 'Panes' @@ -164,6 +163,7 @@ label: 'Developer' submenu: [ { label: 'Open In Dev Mode…', command: 'application:open-dev' } + { label: 'Reload Window', command: 'window:reload' } { label: 'Run Package Specs', command: 'window:run-package-specs' } { label: 'Toggle Developer Tools', command: 'window:toggle-dev-tools' } ] diff --git a/menus/linux.cson b/menus/linux.cson index fa831b4a4..9f251d67f 100644 --- a/menus/linux.cson +++ b/menus/linux.cson @@ -95,7 +95,6 @@ { label: '&View' submenu: [ - { label: '&Reload', command: 'window:reload' } { label: 'Toggle &Full Screen', command: 'window:toggle-full-screen' } { label: 'Toggle Menu Bar', command: 'window:toggle-menu-bar' } { @@ -121,6 +120,7 @@ label: 'Developer' submenu: [ { label: 'Open In &Dev Mode…', command: 'application:open-dev' } + { label: '&Reload Window', command: 'window:reload' } { label: 'Run Package &Specs', command: 'window:run-package-specs' } { label: 'Toggle Developer &Tools', command: 'window:toggle-dev-tools' } ] diff --git a/menus/win32.cson b/menus/win32.cson index 04da3d388..ad0461898 100644 --- a/menus/win32.cson +++ b/menus/win32.cson @@ -94,7 +94,6 @@ { label: '&View' submenu: [ - { label: '&Reload', command: 'window:reload' } { label: 'Toggle &Full Screen', command: 'window:toggle-full-screen' } { label: 'Toggle Menu Bar', command: 'window:toggle-menu-bar' } { @@ -120,6 +119,7 @@ label: 'Developer' submenu: [ { label: 'Open In &Dev Mode…', command: 'application:open-dev' } + { label: '&Reload Window', command: 'window:reload' } { label: 'Run Package &Specs', command: 'window:run-package-specs' } { label: 'Toggle Developer &Tools', command: 'window:toggle-dev-tools' } ] diff --git a/package.json b/package.json index 4a9db71c0..67efaedf0 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "grim": "1.5.0", "jasmine-json": "~0.0", "jasmine-tagged": "^1.1.4", - "jquery": "^2.1.1", + "jquery": "2.1.4", "key-path-helpers": "^0.4.0", "less-cache": "0.22", "marked": "^0.3.4", @@ -104,7 +104,7 @@ "open-on-github": "0.40.0", "package-generator": "0.41.0", "release-notes": "0.53.0", - "settings-view": "0.232.1", + "settings-view": "0.232.3", "snippets": "1.0.1", "spell-check": "0.63.0", "status-bar": "0.80.0", @@ -112,7 +112,7 @@ "symbols-view": "0.110.1", "tabs": "0.88.0", "timecop": "0.33.0", - "tree-view": "0.198.0", + "tree-view": "0.198.1", "update-package-dependencies": "0.10.0", "welcome": "0.33.0", "whitespace": "0.32.1", @@ -125,11 +125,11 @@ "language-gfm": "0.82.0", "language-git": "0.11.0", "language-go": "0.41.0", - "language-html": "0.43.1", + "language-html": "0.44.0", "language-hyperlink": "0.16.0", "language-java": "0.17.0", "language-javascript": "0.105.0", - "language-json": "0.17.2", + "language-json": "0.17.3", "language-less": "0.29.0", "language-make": "0.21.0", "language-mustache": "0.13.0", @@ -137,7 +137,7 @@ "language-perl": "0.32.0", "language-php": "0.36.0", "language-property-list": "0.8.0", - "language-python": "0.42.1", + "language-python": "0.43.0", "language-ruby": "0.67.0", "language-ruby-on-rails": "0.25.0", "language-sass": "0.45.0", diff --git a/spec/pane-spec.coffee b/spec/pane-spec.coffee index 36803bde6..5c5cd9e95 100644 --- a/spec/pane-spec.coffee +++ b/spec/pane-spec.coffee @@ -18,6 +18,8 @@ describe "Pane", -> onDidDestroy: (fn) -> @emitter.on('did-destroy', fn) destroy: -> @destroyed = true; @emitter.emit('did-destroy') isDestroyed: -> @destroyed + isPending: -> @pending + pending: false beforeEach -> confirm = spyOn(atom.applicationDelegate, 'confirm') @@ -153,6 +155,26 @@ describe "Pane", -> pane.activateItem(pane.itemAtIndex(1)) expect(observed).toEqual [pane.itemAtIndex(1)] + it "replaces pending items", -> + itemC = new Item("C") + itemD = new Item("D") + itemC.pending = true + itemD.pending = true + + expect(itemC.isPending()).toBe true + pane.activateItem(itemC) + expect(pane.getItems().length).toBe 3 + expect(pane.getActiveItem()).toBe pane.itemAtIndex(1) + + expect(itemD.isPending()).toBe true + pane.activateItem(itemD) + expect(pane.getItems().length).toBe 3 + expect(pane.getActiveItem()).toBe pane.itemAtIndex(1) + + pane.activateItem(pane.itemAtIndex(2)) + expect(pane.getItems().length).toBe 2 + expect(pane.getActiveItem()).toBe pane.itemAtIndex(1) + describe "::activateNextItem() and ::activatePreviousItem()", -> it "sets the active item to the next/previous item, looping around at either end", -> pane = new Pane(paneParams(items: [new Item("A"), new Item("B"), new Item("C")])) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 02d2e4a96..ce84d2c50 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -5804,3 +5804,29 @@ describe "TextEditor", -> screenRange: marker1.getRange(), rangeIsReversed: false } + + describe "pending state", -> + editor1 = null + beforeEach -> + waitsForPromise -> + atom.workspace.open('sample.txt', pending: true).then (o) -> editor1 = o + + it "should open file in pending state if 'pending' option is true", -> + expect(editor1.isPending()).toBe true + expect(editor.isPending()).toBe false # By default pending status is false + + it "invokes ::onDidTerminatePendingState observers if pending status is terminated", -> + events = [] + editor1.onDidTerminatePendingState (event) -> events.push(event) + editor1.terminatePendingState() + expect(editor1.isPending()).toBe false + expect(events).toEqual [editor1] + + it "should terminate pending state when buffer is changed", -> + events = [] + editor1.onDidTerminatePendingState (event) -> events.push(event) + expect(editor1.isPending()).toBe true + editor1.insertText('I\'ll be back!') + advanceClock(500) + expect(editor1.isPending()).toBe false + expect(events).toEqual [editor1] diff --git a/src/pane.coffee b/src/pane.coffee index c006e29fe..a9c4d45e2 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -337,13 +337,19 @@ class Pane extends Model # # * `index` {Number} activateItemAtIndex: (index) -> - @activateItem(@itemAtIndex(index)) + item = @itemAtIndex(index) or @getActiveItem() + @setActiveItem(item) # Public: Make the given item *active*, causing it to be displayed by # the pane's view. activateItem: (item) -> if item? - @addItem(item, @getActiveItemIndex() + 1, false) + if @activeItem?.isPending?() + index = @getActiveItemIndex() + @destroyActiveItem() unless item is @activeItem + else + index = @getActiveItemIndex() + 1 + @addItem(item, index, false) @setActiveItem(item) # Public: Add the given item to the pane. @@ -574,7 +580,6 @@ class Pane extends Model # Public: Makes this pane the *active* pane, causing it to gain focus. activate: -> throw new Error("Pane has been destroyed") if @isDestroyed() - @container?.setActivePane(this) @emitter.emit 'did-activate' diff --git a/src/text-editor.coffee b/src/text-editor.coffee index dbae445d1..95892325c 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -92,7 +92,7 @@ class TextEditor extends Model softWrapped, @displayBuffer, @selectionsMarkerLayer, buffer, suppressCursorCreation, @mini, @placeholderText, lineNumberGutterVisible, largeFileMode, @config, @notificationManager, @packageManager, @clipboard, @viewRegistry, @grammarRegistry, - @project, @assert, @applicationDelegate + @project, @assert, @applicationDelegate, @pending } = params throw new Error("Must pass a config parameter when constructing TextEditors") unless @config? @@ -161,6 +161,9 @@ class TextEditor extends Model @disposables.add @buffer.onDidChangeEncoding => @emitter.emit 'did-change-encoding', @getEncoding() @disposables.add @buffer.onDidDestroy => @destroy() + if @pending + @disposables.add @buffer.onDidChangeModified => + @terminatePendingState() if @buffer.isModified() @preserveCursorPositionOnBufferReload() @@ -569,6 +572,13 @@ class TextEditor extends Model getEditorWidthInChars: -> @displayBuffer.getEditorWidthInChars() + onDidTerminatePendingState: (callback) -> + @emitter.on 'did-terminate-pending-state', callback + + terminatePendingState: -> + @pending = false + @emitter.emit 'did-terminate-pending-state', this + ### Section: File Details ### @@ -652,6 +662,9 @@ class TextEditor extends Model # Essential: Returns {Boolean} `true` if this editor has no content. isEmpty: -> @buffer.isEmpty() + # Returns {Boolean} `true` if this editor is pending and `false` if it is permanent. + isPending: -> Boolean(@pending) + # Copies the current file path to the native clipboard. copyPathToClipboard: -> if filePath = @getPath()