Fix deprecation warnings triggered by TextEditor methods

This commit is contained in:
Alhadis 2016-04-02 11:05:16 +11:00
parent a4e32543dd
commit bbae6043d5
1 changed files with 11 additions and 4 deletions

View File

@ -27,6 +27,13 @@ $ = null
# nopt.clean(data, types);
# return data;
# }
getScrollTop = (editor) ->
view = editor.viewRegistry.getView(editor)
view.getScrollTop()
setScrollTop = (editor, value) ->
view = editor.viewRegistry.getView(editor)
view.setScrollTop value
getCursors = (editor) ->
cursors = editor.getCursors()
posArray = []
@ -109,7 +116,7 @@ beautify = ({onSave}) ->
posArray = getCursors(editor)
# console.log "posArray:
origScrollTop = editor.getScrollTop()
origScrollTop = getScrollTop(editor)
# console.log "origScrollTop:
if not forceEntireFile and isSelection
@ -132,7 +139,7 @@ beautify = ({onSave}) ->
setTimeout ( ->
# console.log "setScrollTop"
editor.setScrollTop origScrollTop
setScrollTop editor, origScrollTop
return
), 0
else
@ -495,7 +502,7 @@ handleSaveEvent = ->
logger.verbose('save editor positions', key, beautifyOnSave)
if beautifyOnSave
posArray = getCursors(editor)
origScrollTop = editor.getScrollTop()
origScrollTop = getScrollTop(editor)
beautifyFilePath(filePath, ->
if editor.isAlive() is true
buffer.reload()
@ -505,7 +512,7 @@ handleSaveEvent = ->
# addition happens asynchronously
setTimeout ( ->
setCursors(editor, posArray)
editor.setScrollTop(origScrollTop)
setScrollTop(editor, origScrollTop)
# console.log "setScrollTop"
return
), 0