mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Merge remote-tracking branch 'remotes/origin/dh-async-repo' into dh-async-repo-relativize-symlinks
This commit is contained in:
commit
9fe2470a05
17
CHANGELOG.md
17
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.
|
||||
|
@ -13,7 +13,7 @@
|
||||
'ctrl-alt-o': 'application:add-project-folder'
|
||||
'ctrl-shift-pageup': 'pane:move-item-left'
|
||||
'ctrl-shift-pagedown': 'pane:move-item-right'
|
||||
'F11': 'window:toggle-full-screen'
|
||||
'f11': 'window:toggle-full-screen'
|
||||
|
||||
# Sublime Parity
|
||||
'ctrl-,': 'application:show-settings'
|
||||
|
@ -19,7 +19,7 @@
|
||||
'ctrl-alt-o': 'application:add-project-folder'
|
||||
'ctrl-shift-left': 'pane:move-item-left'
|
||||
'ctrl-shift-right': 'pane:move-item-right'
|
||||
'F11': 'window:toggle-full-screen'
|
||||
'f11': 'window:toggle-full-screen'
|
||||
|
||||
# Sublime Parity
|
||||
'ctrl-,': 'application:show-settings'
|
||||
|
@ -110,36 +110,9 @@
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
label: 'Selection'
|
||||
submenu: [
|
||||
{ label: 'Add Selection Above', command: 'editor:add-selection-above' }
|
||||
{ label: 'Add Selection Below', command: 'editor:add-selection-below' }
|
||||
{ label: 'Single Selection', command: 'editor:consolidate-selections'}
|
||||
{ label: 'Split into Lines', command: 'editor:split-selections-into-lines'}
|
||||
{ type: 'separator' }
|
||||
{ label: 'Select to Top', command: 'core:select-to-top' }
|
||||
{ label: 'Select to Bottom', command: 'core:select-to-bottom' }
|
||||
{ type: 'separator' }
|
||||
{ label: 'Select Line', command: 'editor:select-line' }
|
||||
{ label: 'Select Word', command: 'editor:select-word' }
|
||||
{ label: 'Select to Beginning of Word', command: 'editor:select-to-beginning-of-word' }
|
||||
{ label: 'Select to Beginning of Line', command: 'editor:select-to-beginning-of-line' }
|
||||
{ label: 'Select to First Character of Line', command: 'editor:select-to-first-character-of-line' }
|
||||
{ label: 'Select to End of Word', command: 'editor:select-to-end-of-word' }
|
||||
{ label: 'Select to End of Line', command: 'editor:select-to-end-of-line' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
label: 'Find'
|
||||
submenu: []
|
||||
}
|
||||
|
||||
{
|
||||
label: 'View'
|
||||
submenu: [
|
||||
{ label: 'Reload', command: 'window:reload' }
|
||||
{ label: 'Toggle Full Screen', command: 'window:toggle-full-screen' }
|
||||
{
|
||||
label: 'Panes'
|
||||
@ -164,6 +137,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' }
|
||||
]
|
||||
@ -177,6 +151,32 @@
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
label: 'Selection'
|
||||
submenu: [
|
||||
{ label: 'Add Selection Above', command: 'editor:add-selection-above' }
|
||||
{ label: 'Add Selection Below', command: 'editor:add-selection-below' }
|
||||
{ label: 'Single Selection', command: 'editor:consolidate-selections'}
|
||||
{ label: 'Split into Lines', command: 'editor:split-selections-into-lines'}
|
||||
{ type: 'separator' }
|
||||
{ label: 'Select to Top', command: 'core:select-to-top' }
|
||||
{ label: 'Select to Bottom', command: 'core:select-to-bottom' }
|
||||
{ type: 'separator' }
|
||||
{ label: 'Select Line', command: 'editor:select-line' }
|
||||
{ label: 'Select Word', command: 'editor:select-word' }
|
||||
{ label: 'Select to Beginning of Word', command: 'editor:select-to-beginning-of-word' }
|
||||
{ label: 'Select to Beginning of Line', command: 'editor:select-to-beginning-of-line' }
|
||||
{ label: 'Select to First Character of Line', command: 'editor:select-to-first-character-of-line' }
|
||||
{ label: 'Select to End of Word', command: 'editor:select-to-end-of-word' }
|
||||
{ label: 'Select to End of Line', command: 'editor:select-to-end-of-line' }
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
label: 'Find'
|
||||
submenu: []
|
||||
}
|
||||
|
||||
{
|
||||
label: 'Packages'
|
||||
submenu: []
|
||||
|
@ -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' }
|
||||
]
|
||||
|
@ -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' }
|
||||
]
|
||||
|
18
package.json
18
package.json
@ -32,11 +32,11 @@
|
||||
"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",
|
||||
"nodegit": "0.6.3",
|
||||
"nodegit": "0.7.0",
|
||||
"normalize-package-data": "^2.0.0",
|
||||
"nslog": "^3",
|
||||
"oniguruma": "^5",
|
||||
@ -104,15 +104,15 @@
|
||||
"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",
|
||||
"spell-check": "0.65.0",
|
||||
"status-bar": "0.80.0",
|
||||
"styleguide": "0.45.0",
|
||||
"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,8 +137,8 @@
|
||||
"language-perl": "0.32.0",
|
||||
"language-php": "0.36.0",
|
||||
"language-property-list": "0.8.0",
|
||||
"language-python": "0.42.1",
|
||||
"language-ruby": "0.67.0",
|
||||
"language-python": "0.43.0",
|
||||
"language-ruby": "0.67.1",
|
||||
"language-ruby-on-rails": "0.25.0",
|
||||
"language-sass": "0.45.0",
|
||||
"language-shellscript": "0.21.0",
|
||||
|
@ -1253,6 +1253,13 @@ describe "DisplayBuffer", ->
|
||||
decoration.destroy()
|
||||
expect(displayBuffer.decorationForId(decoration.id)).not.toBeDefined()
|
||||
|
||||
it "does not allow destroyed markers to be decorated", ->
|
||||
marker.destroy()
|
||||
expect(->
|
||||
displayBuffer.decorateMarker(marker, {type: 'overlay', item: document.createElement('div')})
|
||||
).toThrow("Cannot decorate a destroyed marker")
|
||||
expect(displayBuffer.getOverlayDecorations()).toEqual []
|
||||
|
||||
describe "when a decoration is updated via Decoration::update()", ->
|
||||
it "emits an 'updated' event containing the new and old params", ->
|
||||
decoration.onDidChangeProperties updatedSpy = jasmine.createSpy()
|
||||
|
@ -246,6 +246,10 @@ describe('GitRepositoryAsync', () => {
|
||||
runs(() => editor = atom.workspace.getActiveTextEditor())
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
editor = null
|
||||
})
|
||||
|
||||
it('displays a confirmation dialog by default', async () => {
|
||||
atom.confirm.andCallFake(({buttons}) => buttons.OK())
|
||||
atom.config.set('editor.confirmCheckoutHeadRevision', true)
|
||||
@ -266,8 +270,12 @@ describe('GitRepositoryAsync', () => {
|
||||
})
|
||||
|
||||
describe('.destroy()', () => {
|
||||
beforeEach(() => {
|
||||
const workingDirectory = copyRepository()
|
||||
repo = GitRepositoryAsync.open(workingDirectory)
|
||||
})
|
||||
|
||||
it('throws an exception when any method is called after it is called', async () => {
|
||||
repo = new GitRepositoryAsync(require.resolve('./fixtures/git/master.git/HEAD'))
|
||||
repo.destroy()
|
||||
|
||||
let error = null
|
||||
@ -276,7 +284,10 @@ describe('GitRepositoryAsync', () => {
|
||||
} catch (e) {
|
||||
error = e
|
||||
}
|
||||
|
||||
expect(error.name).toBe(GitRepositoryAsync.DestroyedErrorName)
|
||||
|
||||
repo = null
|
||||
})
|
||||
})
|
||||
|
||||
@ -404,7 +415,7 @@ describe('GitRepositoryAsync', () => {
|
||||
// need to wait for that to complete before the tests continue so that
|
||||
// we're in a known state.
|
||||
repo = atom.project.getRepositories()[0].async
|
||||
waitsFor(() => !repo._isRefreshing())
|
||||
waitsForPromise(() => repo.refreshStatus())
|
||||
})
|
||||
|
||||
it('emits a status-changed event when a buffer is saved', async () => {
|
||||
@ -480,7 +491,7 @@ describe('GitRepositoryAsync', () => {
|
||||
// See the comment in the 'buffer events' beforeEach for why we need to do
|
||||
// this.
|
||||
const repository = atom.project.getRepositories()[0].async
|
||||
waitsFor(() => !repository._isRefreshing())
|
||||
waitsForPromise(() => repository.refreshStatus())
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
@ -494,7 +505,7 @@ describe('GitRepositoryAsync', () => {
|
||||
project2.deserialize(atom.project.serialize(), atom.deserializers)
|
||||
|
||||
const repo = project2.getRepositories()[0].async
|
||||
waitsFor(() => !repo._isRefreshing())
|
||||
waitsForPromise(() => repo.refreshStatus())
|
||||
runs(() => {
|
||||
const buffer = project2.getBuffers()[0]
|
||||
|
||||
|
@ -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")]))
|
||||
|
@ -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]
|
||||
|
@ -812,6 +812,7 @@ class DisplayBuffer extends Model
|
||||
decorationsState
|
||||
|
||||
decorateMarker: (marker, decorationParams) ->
|
||||
throw new Error("Cannot decorate a destroyed marker") if marker.isDestroyed()
|
||||
marker = @getMarkerLayer(marker.layer.id).getMarker(marker.id)
|
||||
decoration = new Decoration(marker, this, decorationParams)
|
||||
@decorationsByMarkerId[marker.id] ?= []
|
||||
|
@ -42,7 +42,7 @@ export default class GitRepositoryAsync {
|
||||
this.upstream = {}
|
||||
this.submodules = {}
|
||||
|
||||
this._refreshingCount = 0
|
||||
this._refreshingPromise = Promise.resolve()
|
||||
|
||||
let {refreshOnWindowFocus = true} = options
|
||||
if (refreshOnWindowFocus) {
|
||||
@ -471,8 +471,6 @@ export default class GitRepositoryAsync {
|
||||
// Returns a {Promise} which resolves to a {Number} which is the refreshed
|
||||
// status bit for the path.
|
||||
refreshStatusForPath (_path) {
|
||||
this._refreshingCount++
|
||||
|
||||
let relativePath
|
||||
return this.getRepo()
|
||||
.then(repo => {
|
||||
@ -494,10 +492,6 @@ export default class GitRepositoryAsync {
|
||||
|
||||
return status
|
||||
})
|
||||
.then(status => {
|
||||
this._refreshingCount--
|
||||
return status
|
||||
})
|
||||
}
|
||||
|
||||
// Returns a Promise that resolves to the status bit of a given path if it has
|
||||
@ -695,17 +689,16 @@ export default class GitRepositoryAsync {
|
||||
// =======
|
||||
|
||||
checkoutHeadForEditor (editor) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const filePath = editor.getPath()
|
||||
if (filePath) {
|
||||
if (editor.buffer.isModified()) {
|
||||
editor.buffer.reload()
|
||||
}
|
||||
resolve(filePath)
|
||||
} else {
|
||||
reject()
|
||||
}
|
||||
}).then(filePath => this.checkoutHead(filePath))
|
||||
const filePath = editor.getPath()
|
||||
if (!filePath) {
|
||||
return Promise.reject()
|
||||
}
|
||||
|
||||
if (editor.buffer.isModified()) {
|
||||
editor.buffer.reload()
|
||||
}
|
||||
|
||||
return this.checkoutHead(filePath)
|
||||
}
|
||||
|
||||
// Create a new branch with the given name.
|
||||
@ -887,8 +880,6 @@ export default class GitRepositoryAsync {
|
||||
//
|
||||
// Returns a {Promise} which will resolve to {null}.
|
||||
_refreshStatus () {
|
||||
this._refreshingCount++
|
||||
|
||||
return Promise.all([this._getRepositoryStatus(), this._getSubmoduleStatuses()])
|
||||
.then(([repositoryStatus, submoduleStatus]) => {
|
||||
const statusesByPath = _.extend({}, repositoryStatus, submoduleStatus)
|
||||
@ -897,7 +888,6 @@ export default class GitRepositoryAsync {
|
||||
}
|
||||
this.pathStatusCache = statusesByPath
|
||||
})
|
||||
.then(_ => this._refreshingCount--)
|
||||
}
|
||||
|
||||
// Refreshes the git status.
|
||||
@ -908,18 +898,26 @@ export default class GitRepositoryAsync {
|
||||
const branch = this._refreshBranch()
|
||||
const aheadBehind = branch.then(branchName => this._refreshAheadBehindCount(branchName))
|
||||
|
||||
return Promise.all([status, branch, aheadBehind])
|
||||
.then(_ => null)
|
||||
// Because all these refresh steps happen asynchronously, it's entirely
|
||||
// possible the repository was destroyed while we were working. In which
|
||||
// case we should just swallow the error.
|
||||
.catch(e => {
|
||||
if (this._isDestroyed()) {
|
||||
return null
|
||||
} else {
|
||||
this._refreshingPromise = this._refreshingPromise.then(_ => {
|
||||
return Promise.all([status, branch, aheadBehind])
|
||||
.then(_ => null)
|
||||
// Because all these refresh steps happen asynchronously, it's entirely
|
||||
// possible the repository was destroyed while we were working. In which
|
||||
// case we should just swallow the error.
|
||||
.catch(e => {
|
||||
if (this._isDestroyed()) {
|
||||
return null
|
||||
} else {
|
||||
return Promise.reject(e)
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.error('Error refreshing repository status:')
|
||||
console.error(e)
|
||||
return Promise.reject(e)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
return this._refreshingPromise
|
||||
}
|
||||
|
||||
// Get the submodule for the given path.
|
||||
@ -975,13 +973,6 @@ export default class GitRepositoryAsync {
|
||||
// Section: Private
|
||||
// ================
|
||||
|
||||
// Is the repository currently refreshing its status?
|
||||
//
|
||||
// Returns a {Boolean}.
|
||||
_isRefreshing () {
|
||||
return this._refreshingCount === 0
|
||||
}
|
||||
|
||||
// Has the repository been destroyed?
|
||||
//
|
||||
// Returns a {Boolean}.
|
||||
|
@ -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'
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user