💄 Replace editor.getBuffer().getPath() w/ editor.getPath()

This commit is contained in:
Nathan Sobo
2012-07-04 12:40:17 -06:00
parent 39ce15c3fa
commit 6d7a6f9a92
11 changed files with 42 additions and 41 deletions

View File

@@ -247,6 +247,7 @@ class Editor extends View
setText: (text) -> @getBuffer().setText(text)
getText: -> @getBuffer().getText()
getPath: -> @getBuffer().getPath()
getLastBufferRow: -> @getBuffer().getLastRow()
getTextInRange: (range) -> @getBuffer().getTextInRange(range)
getEofPosition: -> @getBuffer().getEofPosition()
@@ -498,7 +499,7 @@ class Editor extends View
$(window).off 'resize', @_setSoftWrapColumn
save: ->
if not @getBuffer().getPath()
if not @getPath()
path = Native.saveDialog()
return false if not path
@getBuffer().saveAs(path)
@@ -539,7 +540,7 @@ class Editor extends View
close: ->
return if @mini
if @getBuffer().isModified()
filename = if @getBuffer().getPath() then fs.base(@getBuffer().getPath()) else "untitled buffer"
filename = if @getPath() then fs.base(@getPath()) else "untitled buffer"
message = "'#{filename}' has changes, do you want to save them?"
detailedMessage = "Your changes will be lost if you don't save them"
buttons = [

View File

@@ -132,9 +132,9 @@ class RootView extends View
if not editor.mini
editor.on 'editor-path-change.root-view', =>
@trigger 'active-editor-path-change', editor.getBuffer().getPath()
if not previousActiveEditor or editor.getBuffer().getPath() != previousActiveEditor.getBuffer().getPath()
@trigger 'active-editor-path-change', editor.getBuffer().getPath()
@trigger 'active-editor-path-change', editor.getPath()
if not previousActiveEditor or editor.getPath() != previousActiveEditor.getPath()
@trigger 'active-editor-path-change', editor.getPath()
activeKeybindings: ->
keymap.bindingsForElement(document.activeElement)

View File

@@ -28,7 +28,7 @@ class StatusBar extends View
@editor.on 'cursor-move', => @updateCursorPositionText()
updatePathText: ->
path = @editor.getBuffer().getPath()
path = @editor.getPath()
if path
@currentPath.text(@rootView.project.relativize(path))
else

View File

@@ -1 +1 @@
module.exports = require 'autocomplete/autocomplete.coffee'
module.exports = require 'autocomplete/autocomplete.coffee'

View File

@@ -1 +1 @@
module.exports = require 'command-panel/command-panel'
module.exports = require 'command-panel/command-panel'

View File

@@ -101,7 +101,7 @@ class TreeView extends View
@append(@root)
selectActiveFile: ->
activeFilePath = @rootView.getActiveEditor()?.getBuffer().getPath()
activeFilePath = @rootView.getActiveEditor()?.getPath()
@selectEntryForPath(activeFilePath)
selectEntryForPath: (path) ->