Fixes #103. BeautifyEntireFileOnSave only applies when saving

This commit is contained in:
Glavin Wiechert 2014-10-26 16:35:59 -03:00
parent 9ec22bf43f
commit dda313fbfe
1 changed files with 3 additions and 3 deletions

View File

@ -125,7 +125,7 @@ getConfigOptionsFromSettings = (langs) ->
# console.log(options);
options
beautify = ->
beautify = ({onSave})->
path ?= require("path")
MessagePanelView ?= require('atom-message-panel').MessagePanelView
PlainMessageView ?= require('atom-message-panel').PlainMessageView
@ -133,7 +133,7 @@ beautify = ->
@messagePanel ?= new MessagePanelView title: 'Atom Beautify Error Messages'
@loadingView ?= new LoadingView()
@loadingView.show()
forceEntireFile = atom.config.get("atom-beautify.beautifyEntireFileOnSave")
forceEntireFile = onSave && atom.config.get("atom-beautify.beautifyEntireFileOnSave")
# Show error
showError = (e) =>
@loadingView.hide()
@ -306,7 +306,7 @@ handleSaveEvent = =>
plugin.unsubscribe buffer
if atom.config.get("atom-beautify.beautifyOnSave")
events = "will-be-saved"
plugin.subscribe buffer, events, beautify.bind(@)
plugin.subscribe buffer, events, beautify.bind(@, {onSave:true})
return
return