mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Add explicit return after for loop
This commit is contained in:
@@ -124,6 +124,7 @@ class TextEditorPresenter
|
||||
@disposables.add @model.onDidChangeScrollLeft(@setScrollLeft.bind(this))
|
||||
@observeDecoration(decoration) for decoration in @model.getDecorations()
|
||||
@observeCursor(cursor) for cursor in @model.getCursors()
|
||||
return
|
||||
|
||||
observeConfig: ->
|
||||
configParams = {scope: @model.getRootScopeDescriptor()}
|
||||
@@ -273,6 +274,7 @@ class TextEditorPresenter
|
||||
for id, line of @state.content.lines
|
||||
unless visibleLineIds.hasOwnProperty(id)
|
||||
delete @state.content.lines[id]
|
||||
return
|
||||
|
||||
updateLineState: (row, line) ->
|
||||
lineState = @state.content.lines[line.id]
|
||||
@@ -296,6 +298,7 @@ class TextEditorPresenter
|
||||
updateCursorsState: -> @batch "shouldUpdateCursorsState", ->
|
||||
@state.content.cursors = {}
|
||||
@updateCursorState(cursor) for cursor in @model.cursors # using property directly to avoid allocation
|
||||
return
|
||||
|
||||
updateCursorState: (cursor, destroyOnly = false) ->
|
||||
delete @state.content.cursors[cursor.id]
|
||||
@@ -331,6 +334,8 @@ class TextEditorPresenter
|
||||
for id of @state.content.overlays
|
||||
delete @state.content.overlays[id] unless visibleDecorationIds[id]
|
||||
|
||||
return
|
||||
|
||||
updateGutterState: -> @batch "shouldUpdateGutterState", ->
|
||||
@state.gutter.visible = not @model.isMini() and (@model.isGutterVisible() ? true) and @showLineNumbers
|
||||
@state.gutter.maxLineNumberDigits = @model.getLineCount().toString().length
|
||||
@@ -382,6 +387,8 @@ class TextEditorPresenter
|
||||
for id of @state.gutter.lineNumbers
|
||||
delete @state.gutter.lineNumbers[id] unless visibleLineNumberIds[id]
|
||||
|
||||
return
|
||||
|
||||
updateStartRow: ->
|
||||
return unless @scrollTop? and @lineHeight?
|
||||
|
||||
@@ -873,11 +880,13 @@ class TextEditorPresenter
|
||||
unless visibleHighlights[id]
|
||||
delete @state.content.highlights[id]
|
||||
|
||||
return
|
||||
|
||||
removeFromLineDecorationCaches: (decoration, range) ->
|
||||
for row in [range.start.row..range.end.row] by 1
|
||||
delete @lineDecorationsByScreenRow[row]?[decoration.id]
|
||||
delete @lineNumberDecorationsByScreenRow[row]?[decoration.id]
|
||||
return
|
||||
|
||||
addToLineDecorationCaches: (decoration, range) ->
|
||||
marker = decoration.getMarker()
|
||||
@@ -903,6 +912,8 @@ class TextEditorPresenter
|
||||
@lineNumberDecorationsByScreenRow[row] ?= {}
|
||||
@lineNumberDecorationsByScreenRow[row][decoration.id] = decoration
|
||||
|
||||
return
|
||||
|
||||
updateHighlightState: (decoration) ->
|
||||
return unless @startRow? and @endRow? and @lineHeight? and @hasPixelPositionRequirements()
|
||||
|
||||
|
||||
@@ -842,7 +842,9 @@ class TextEditor extends Model
|
||||
# {Number} index of that selection.
|
||||
mutateSelectedText: (fn) ->
|
||||
@mergeIntersectingSelections =>
|
||||
@transact => fn(selection, index) for selection, index in @getSelections()
|
||||
@transact =>
|
||||
fn(selection, index) for selection, index in @getSelections()
|
||||
return
|
||||
|
||||
# Move lines intersection the most recent selection up by one row in screen
|
||||
# coordinates.
|
||||
@@ -978,6 +980,7 @@ class TextEditor extends Model
|
||||
selection.setBufferRange(selectedBufferRange.translate([delta, 0]))
|
||||
for [foldStartRow, foldEndRow] in foldedRowRanges
|
||||
@createFold(foldStartRow + delta, foldEndRow + delta)
|
||||
return
|
||||
|
||||
# Deprecated: Use {::duplicateLines} instead.
|
||||
duplicateLine: ->
|
||||
@@ -1013,6 +1016,7 @@ class TextEditor extends Model
|
||||
while ++row < end.row
|
||||
@addSelectionForBufferRange([[row, 0], [row, Infinity]])
|
||||
@addSelectionForBufferRange([[end.row, 0], [end.row, end.column]]) unless end.column is 0
|
||||
return
|
||||
|
||||
# Extended: For each selection, transpose the selected text.
|
||||
#
|
||||
@@ -1779,7 +1783,7 @@ class TextEditor extends Model
|
||||
|
||||
# Extended: Get an Array of all {Cursor}s.
|
||||
getCursors: ->
|
||||
cursor for cursor in @cursors
|
||||
@cursors.slice()
|
||||
|
||||
# Extended: Get all {Cursors}s, ordered by their position in the buffer
|
||||
# instead of the order in which they were added.
|
||||
@@ -1822,6 +1826,7 @@ class TextEditor extends Model
|
||||
cursor.destroy()
|
||||
else
|
||||
positions[position] = true
|
||||
return
|
||||
|
||||
preserveCursorPositionOnBufferReload: ->
|
||||
cursorPosition = null
|
||||
@@ -1886,6 +1891,7 @@ class TextEditor extends Model
|
||||
selections[i].setBufferRange(bufferRange, options)
|
||||
else
|
||||
@addSelectionForBufferRange(bufferRange, options)
|
||||
return
|
||||
|
||||
# Essential: Get the {Range} of the most recently added selection in screen
|
||||
# coordinates.
|
||||
@@ -1932,6 +1938,7 @@ class TextEditor extends Model
|
||||
selections[i].setScreenRange(screenRange, options)
|
||||
else
|
||||
@addSelectionForScreenRange(screenRange, options)
|
||||
return
|
||||
|
||||
# Essential: Add a selection for the given range in buffer coordinates.
|
||||
#
|
||||
@@ -2159,7 +2166,7 @@ class TextEditor extends Model
|
||||
#
|
||||
# Returns: An {Array} of {Selection}s.
|
||||
getSelections: ->
|
||||
selection for selection in @selections
|
||||
@selections.slice()
|
||||
|
||||
# Extended: Get all {Selection}s, ordered by their position in the buffer
|
||||
# instead of the order in which they were added.
|
||||
@@ -2206,15 +2213,18 @@ class TextEditor extends Model
|
||||
expandSelectionsForward: (fn) ->
|
||||
@mergeIntersectingSelections =>
|
||||
fn(selection) for selection in @getSelections()
|
||||
return
|
||||
|
||||
# Calls the given function with each selection, then merges selections in the
|
||||
# reversed orientation
|
||||
expandSelectionsBackward: (fn) ->
|
||||
@mergeIntersectingSelections reversed: true, =>
|
||||
fn(selection) for selection in @getSelections()
|
||||
return
|
||||
|
||||
finalizeSelections: ->
|
||||
selection.finalize() for selection in @getSelections()
|
||||
return
|
||||
|
||||
selectionsForScreenRows: (startRow, endRow) ->
|
||||
@getSelections().filter (selection) -> selection.intersectsScreenRowRange(startRow, endRow)
|
||||
@@ -2620,6 +2630,7 @@ class TextEditor extends Model
|
||||
else
|
||||
selection.copy(maintainClipboard, false)
|
||||
maintainClipboard = true
|
||||
return
|
||||
|
||||
# Essential: For each selection, cut the selected text.
|
||||
cutSelectedText: ->
|
||||
@@ -2714,6 +2725,7 @@ class TextEditor extends Model
|
||||
# Extended: For each selection, fold the rows it intersects.
|
||||
foldSelectedLines: ->
|
||||
selection.fold() for selection in @getSelections()
|
||||
return
|
||||
|
||||
# Extended: Fold all foldable lines.
|
||||
foldAll: ->
|
||||
@@ -2796,6 +2808,8 @@ class TextEditor extends Model
|
||||
for row in [bufferRange.end.row..bufferRange.start.row]
|
||||
fold.destroy() for fold in @displayBuffer.foldsStartingAtBufferRow(row)
|
||||
|
||||
return
|
||||
|
||||
# Remove any {Fold}s found that contain the given buffer range.
|
||||
destroyFoldsContainingBufferRange: (bufferRange) ->
|
||||
@unfoldBufferRow(bufferRange.start.row)
|
||||
|
||||
@@ -197,6 +197,7 @@ class TokenizedBuffer extends Model
|
||||
|
||||
validateRow: (row) ->
|
||||
@invalidRows.shift() while @invalidRows[0] <= row
|
||||
return
|
||||
|
||||
invalidateRow: (row) ->
|
||||
@invalidRows.push(row)
|
||||
@@ -468,3 +469,4 @@ class TokenizedBuffer extends Model
|
||||
for row in [start..end]
|
||||
line = @tokenizedLineForRow(row).text
|
||||
console.log row, line, line.length
|
||||
return
|
||||
|
||||
@@ -222,6 +222,7 @@ class TokenizedLine
|
||||
if @lineEnding? and (index + token.value.length > firstTrailingWhitespaceIndex)
|
||||
token.firstTrailingWhitespaceIndex = Math.max(0, firstTrailingWhitespaceIndex - index)
|
||||
index += token.value.length
|
||||
return
|
||||
|
||||
substituteInvisibleCharacters: ->
|
||||
invisibles = @invisibles
|
||||
@@ -309,6 +310,8 @@ class TokenizedLine
|
||||
for j in [i...desiredScopeDescriptor.length]
|
||||
scopeStack.push(new Scope(desiredScopeDescriptor[j]))
|
||||
|
||||
return
|
||||
|
||||
class Scope
|
||||
constructor: (@scope) ->
|
||||
@children = []
|
||||
|
||||
Reference in New Issue
Block a user