mirror of
https://github.com/atom/atom.git
synced 2026-01-21 04:48:12 -05:00
Pass options through to the text buffer
This commit is contained in:
@@ -348,6 +348,7 @@ class Selection extends Model
|
||||
# * `autoIndentNewline` if `true`, indent newline appropriately.
|
||||
# * `autoDecreaseIndent` if `true`, decreases indent level appropriately
|
||||
# (for example, when a closing bracket is inserted).
|
||||
# * `normalizeLineEndings` (optional) {Boolean} (default: true)
|
||||
# * `undo` if `skip`, skips the undo stack for this operation.
|
||||
insertText: (text, options={}) ->
|
||||
oldBufferRange = @getBufferRange()
|
||||
@@ -359,7 +360,7 @@ class Selection extends Model
|
||||
if options.indentBasis? and not options.autoIndent
|
||||
text = @normalizeIndents(text, options.indentBasis)
|
||||
|
||||
newBufferRange = @editor.buffer.setTextInRange(oldBufferRange, text, pick(options, 'undo'))
|
||||
newBufferRange = @editor.buffer.setTextInRange(oldBufferRange, text, pick(options, 'undo', 'normalizeLineEndings'))
|
||||
|
||||
if options.select
|
||||
@setBufferRange(newBufferRange, reversed: wasReversed)
|
||||
|
||||
@@ -737,9 +737,12 @@ class TextEditor extends Model
|
||||
#
|
||||
# * `range` A {Range} or range-compatible {Array}.
|
||||
# * `text` A {String}
|
||||
# * `options` (optional) {Object}
|
||||
# * `normalizeLineEndings` (optional) {Boolean} (default: true)
|
||||
# * `undo` (optional) {String} 'skip' will skip the undo system
|
||||
#
|
||||
# Returns the {Range} of the newly-inserted text.
|
||||
setTextInBufferRange: (range, text, normalizeLineEndings) -> @getBuffer().setTextInRange(range, text, normalizeLineEndings)
|
||||
setTextInBufferRange: (range, text, options) -> @getBuffer().setTextInRange(range, text, options)
|
||||
|
||||
# Essential: For each selection, replace the selected text with the given text.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user