From 5231a548e36c03da69383bce16bd167e9c634e8c Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 30 Oct 2014 17:49:43 -0700 Subject: [PATCH] Pass options through to the text buffer --- src/selection.coffee | 3 ++- src/text-editor.coffee | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/selection.coffee b/src/selection.coffee index fcda88210..1ff6be28c 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -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) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 1707ae86a..812524482 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -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. #