Move snapshot code to package

This commit is contained in:
probablycorey
2013-11-22 14:38:13 -08:00
parent eb985a9880
commit a0ceb78627
6 changed files with 0 additions and 60 deletions

View File

@@ -2706,21 +2706,6 @@ describe "EditorView", ->
expect(buffer.lineForRow(15)).toBeUndefined()
expect(editorView.getCursorBufferPosition()).toEqual [13, 0]
describe "editor:save-debug-snapshot", ->
it "saves the state of the rendered lines, the display buffer, and the buffer to a file of the user's choosing", ->
saveDialogCallback = null
spyOn(atom, 'showSaveDialog').andCallFake (callback) -> saveDialogCallback = callback
spyOn(fs, 'writeFileSync')
editorView.trigger 'editor:save-debug-snapshot'
statePath = path.join(temp.dir, 'state')
expect(atom.showSaveDialog).toHaveBeenCalled()
saveDialogCallback(statePath)
expect(fs.writeFileSync).toHaveBeenCalled()
expect(fs.writeFileSync.argsForCall[0][0]).toBe statePath
expect(typeof fs.writeFileSync.argsForCall[0][1]).toBe 'string'
describe "when the escape key is pressed on the editor view", ->
it "clears multiple selections if there are any, and otherwise allows other bindings to be handled", ->
atom.keymap.bindKeys 'name', '.editor', 'escape': 'test-event'

View File

@@ -584,12 +584,6 @@ class DisplayBuffer
line = @lineForRow(row).text
console.log row, line, line.length
getDebugSnapshot: ->
lines = ["Display Buffer:"]
for screenLine, row in @linesForRows(0, @getLastRow())
lines.push "#{row}: #{screenLine.text}"
lines.join('\n')
### Internal ###
handleTokenizedBufferChange: (tokenizedBufferChange) =>

View File

@@ -205,7 +205,6 @@ class EditorView extends View
'editor:duplicate-line': @duplicateLine
'editor:join-line': @joinLine
'editor:toggle-indent-guide': => atom.config.toggle('editor.showIndentGuide')
'editor:save-debug-snapshot': @saveDebugSnapshot
'editor:toggle-line-numbers': => atom.config.toggle('editor.showLineNumbers')
'editor:scroll-to-cursor': @scrollToCursorPosition
@@ -1827,25 +1826,6 @@ class EditorView extends View
commitTransaction: -> @activeEditSession.commitTransaction()
abortTransaction: -> @activeEditSession.abortTransaction()
saveDebugSnapshot: ->
atom.showSaveDialog (path) =>
fs.writeFileSync(path, @getDebugSnapshot()) if path
getDebugSnapshot: ->
[
"Debug Snapshot: #{@getPath()}"
@getRenderedLinesDebugSnapshot()
@activeEditSession.getDebugSnapshot()
@getBuffer().getDebugSnapshot()
].join('\n\n')
getRenderedLinesDebugSnapshot: ->
lines = ['Rendered Lines:']
firstRenderedScreenRow = @firstRenderedScreenRow
@renderedLines.find('.line').each (n) ->
lines.push "#{firstRenderedScreenRow + n}: #{$(this).text()}"
lines.join('\n')
logScreenLines: (start, end) ->
@activeEditSession.logScreenLines(start, end)

View File

@@ -1437,10 +1437,3 @@ class Editor
# Private:
getSelectionMarkerAttributes: ->
type: 'selection', editorId: @id, invalidate: 'never'
# Private:
getDebugSnapshot: ->
[
@displayBuffer.getDebugSnapshot()
@displayBuffer.tokenizedBuffer.getDebugSnapshot()
].join('\n\n')

View File

@@ -670,9 +670,3 @@ class TextBuffer extends telepath.Model
for row in [start..end]
line = @lineForRow(row)
console.log row, line, line.length
getDebugSnapshot: ->
lines = ['TextBuffer:']
for row in [0..@getLastRow()]
lines.push "#{row}: #{@lineForRow(row)}"
lines.join('\n')

View File

@@ -322,9 +322,3 @@ class TokenizedBuffer
for row in [start..end]
line = @lineForScreenRow(row).text
console.log row, line, line.length
getDebugSnapshot: ->
lines = ["Tokenized Buffer:"]
for screenLine, row in @linesForScreenRows(0, @getLastRow())
lines.push "#{row}: #{screenLine.text}"
lines.join('\n')