Fix deprecation warnings triggered by TextEditor methods
This commit is contained in:
parent
a4e32543dd
commit
bbae6043d5
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue