mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Merge branch 'master' into global-find
Conflicts: spec/extensions/command-panel-spec.coffee src/app/buffer.coffee src/extensions/command-panel/command-panel.coffee src/extensions/command-panel/keymap.coffee
This commit is contained in:
@@ -60,6 +60,13 @@ class Buffer
|
||||
@setText(fs.read(@file.getPath()))
|
||||
@modified = false
|
||||
|
||||
@file.on "remove", =>
|
||||
@file = null
|
||||
@trigger "path-change", this
|
||||
|
||||
@file.on "move", =>
|
||||
@trigger "path-change", this
|
||||
|
||||
reload: ->
|
||||
@setText(fs.read(@file.getPath()))
|
||||
@modified = false
|
||||
|
||||
@@ -29,8 +29,8 @@ class Directory
|
||||
@unsubscribeFromNativeChangeEvents() if @subscriptionCount() == 0
|
||||
|
||||
subscribeToNativeChangeEvents: ->
|
||||
@watchId = $native.watchPath @path, (eventTypes) =>
|
||||
@trigger 'contents-change' if eventTypes.modified?
|
||||
@watchId = $native.watchPath @path, (eventType) =>
|
||||
@trigger "contents-change" if eventType is "contents-change"
|
||||
|
||||
unsubscribeFromNativeChangeEvents: ->
|
||||
$native.unwatchPath(@path, @watchId)
|
||||
|
||||
@@ -12,6 +12,8 @@ class File
|
||||
throw "Creating file with path that is not a file: #{@path}" unless fs.isFile(@path)
|
||||
@updateMd5()
|
||||
|
||||
setPath: (@path) ->
|
||||
|
||||
getPath: ->
|
||||
@path
|
||||
|
||||
@@ -28,9 +30,17 @@ class File
|
||||
@unsubscribeFromNativeChangeEvents() if @subscriptionCount() == 0
|
||||
|
||||
subscribeToNativeChangeEvents: ->
|
||||
@watchId = $native.watchPath @path, (eventTypes) =>
|
||||
newMd5 = fs.md5ForPath(@getPath())
|
||||
if eventTypes.modified? and newMd5 != @md5
|
||||
@watchId = $native.watchPath @path, (eventType, path) =>
|
||||
if eventType is "remove"
|
||||
@trigger "remove"
|
||||
@off()
|
||||
else if eventType is "move"
|
||||
@setPath(path)
|
||||
@trigger "move"
|
||||
else if eventType is "contents-change"
|
||||
newMd5 = fs.md5ForPath(@getPath())
|
||||
return if newMd5 == @md5
|
||||
|
||||
@md5 = newMd5
|
||||
@trigger 'contents-change'
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ class RootView extends View
|
||||
@content: ->
|
||||
@div id: 'root-view', tabindex: -1, =>
|
||||
@div id: 'horizontal', outlet: 'horizontal', =>
|
||||
@div id: 'panes', outlet: 'panes'
|
||||
@div id: 'vertical', outlet: 'vertical', =>
|
||||
@div id: 'panes', outlet: 'panes'
|
||||
|
||||
@deserialize: ({ projectPath, panesViewState, extensionStates }) ->
|
||||
rootView = new RootView(projectPath, extensionStates: extensionStates, suppressOpen: true)
|
||||
|
||||
Reference in New Issue
Block a user