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:
Nathan Sobo
2012-07-24 17:44:24 -06:00
parent 66f80c2dd8
commit 454557b502
18 changed files with 293 additions and 68 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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'

View File

@@ -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)