Merge remote-tracking branch 'upstream/master' into move-lines-up-and-down-with-multiple-selections

This commit is contained in:
Luke Pommersheim
2015-09-23 08:38:37 +02:00
163 changed files with 3401 additions and 14348 deletions

View File

@@ -17,7 +17,8 @@ GutterContainer = require './gutter-container'
# Essential: This class represents all essential editing state for a single
# {TextBuffer}, including cursor and selection positions, folds, and soft wraps.
# If you're manipulating the state of an editor, use this class. If you're
# interested in the visual appearance of editors, use {TextEditorView} instead.
# interested in the visual appearance of editors, use {TextEditorElement}
# instead.
#
# A single {TextBuffer} can belong to multiple editors. For example, if the
# same file is open in two different panes, Atom creates a separate editor for
@@ -545,8 +546,8 @@ class TextEditor extends Model
# Set the number of characters that can be displayed horizontally in the
# editor.
#
# * `editorWidthInChars` A {Number} representing the width of the {TextEditorView}
# in characters.
# * `editorWidthInChars` A {Number} representing the width of the
# {TextEditorElement} in characters.
setEditorWidthInChars: (editorWidthInChars) ->
@displayBuffer.setEditorWidthInChars(editorWidthInChars)
@@ -1761,18 +1762,11 @@ class TextEditor extends Model
@emitter.emit 'did-add-cursor', cursor
cursor
# Remove the given cursor from this editor.
removeCursor: (cursor) ->
_.remove(@cursors, cursor)
@emit 'cursor-removed', cursor if includeDeprecatedAPIs
@emitter.emit 'did-remove-cursor', cursor
moveCursors: (fn) ->
fn(cursor) for cursor in @getCursors()
@mergeCursors()
cursorMoved: (event) ->
@emit 'cursor-moved', event if includeDeprecatedAPIs
@emitter.emit 'did-change-cursor-position', event
# Merge cursors that have the same screen position
@@ -2259,9 +2253,9 @@ class TextEditor extends Model
# Remove the given selection.
removeSelection: (selection) ->
_.remove(@cursors, selection.cursor)
_.remove(@selections, selection)
atom.assert @selections.length > 0, "Removed last selection"
@emit 'selection-removed', selection if includeDeprecatedAPIs
@emitter.emit 'did-remove-cursor', selection.cursor
@emitter.emit 'did-remove-selection', selection
# Reduce one or more selections to a single empty selection based on the most
@@ -2281,7 +2275,6 @@ class TextEditor extends Model
# Called by the selection
selectionRangeChanged: (event) ->
@emit 'selection-screen-range-changed', event if includeDeprecatedAPIs
@emitter.emit 'did-change-selection-range', event
createLastSelectionIfNeeded: ->
@@ -2672,7 +2665,7 @@ class TextEditor extends Model
@emitter.emit 'did-insert-text', didInsertEvent
# Essential: For each selection, if the selection is empty, cut all characters
# of the containing line following the cursor. Otherwise cut the selected
# of the containing screen line following the cursor. Otherwise cut the selected
# text.
cutToEndOfLine: ->
maintainClipboard = false
@@ -2680,6 +2673,15 @@ class TextEditor extends Model
selection.cutToEndOfLine(maintainClipboard)
maintainClipboard = true
# Essential: For each selection, if the selection is empty, cut all characters
# of the containing buffer line following the cursor. Otherwise cut the
# selected text.
cutToEndOfBufferLine: ->
maintainClipboard = false
@mutateSelectedText (selection) ->
selection.cutToEndOfBufferLine(maintainClipboard)
maintainClipboard = true
###
Section: Folds
###
@@ -3059,9 +3061,6 @@ if includeDeprecatedAPIs
'$verticalScrollbarWidth', '$horizontalScrollbarHeight', '$scrollTop', '$scrollLeft',
toProperty: 'displayBuffer'
TextEditor::getViewClass = ->
require './text-editor-view'
TextEditor::joinLine = ->
deprecate("Use TextEditor::joinLines() instead")
@joinLines()