Move .toggleLineComments method from TokenizedBuffer to TextEditor

This commit is contained in:
Max Brunsfeld
2017-10-23 17:44:45 -07:00
parent 079f4d901c
commit cfe5cfce76
3 changed files with 148 additions and 137 deletions

View File

@@ -9,6 +9,8 @@ TokenizedBuffer = require './tokenized-buffer'
Cursor = require './cursor'
Model = require './model'
Selection = require './selection'
TextEditorUtils = require './text-editor-utils'
TextMateScopeSelector = require('first-mate').ScopeSelector
GutterContainer = require './gutter-container'
TextEditorComponent = null
@@ -123,6 +125,8 @@ class TextEditor extends Model
Object.defineProperty(@prototype, 'languageMode', get: -> @tokenizedBuffer)
Object.assign(@prototype, TextEditorUtils)
@deserialize: (state, atomEnvironment) ->
# TODO: Return null on version mismatch when 1.8.0 has been out for a while
if state.version isnt @prototype.serializationVersion and state.displayBuffer?
@@ -3621,9 +3625,6 @@ class TextEditor extends Model
getNonWordCharacters: (scopes) ->
@scopedSettingsDelegate?.getNonWordCharacters?(scopes) ? @nonWordCharacters
getCommentStrings: (scopes) ->
@scopedSettingsDelegate?.getCommentStrings?(scopes)
###
Section: Event Handlers
###
@@ -3886,8 +3887,6 @@ class TextEditor extends Model
toggleLineCommentForBufferRow: (row) -> @toggleLineCommentsForBufferRows(row, row)
toggleLineCommentsForBufferRows: (start, end) -> @tokenizedBuffer.toggleLineCommentsForBufferRows(start, end)
rowRangeForParagraphAtBufferRow: (bufferRow) ->
return unless NON_WHITESPACE_REGEXP.test(@lineTextForBufferRow(bufferRow))