Upgrade to telepath 0.20.0 so simple selection changes aren't undone

This version of telepath adds an `undo: 'combine'` option which becomes
the default for marker changes. With an undo strategy of 'combine', the
operation is only undone when combined in a transaction with other
operations that are undone. This prevents simple marker updates from
getting pushed to the undo stack.
This commit is contained in:
Nathan Sobo
2013-11-01 16:39:06 -06:00
parent f26110a81b
commit e70f87dfc7
3 changed files with 7 additions and 6 deletions

View File

@@ -35,7 +35,7 @@
"season": "0.14.0",
"semver": "1.1.4",
"space-pen": "2.0.0",
"telepath": "0.19.0",
"telepath": "0.20.0",
"temp": "0.5.0",
"underscore-plus": "0.2.0"
},

View File

@@ -720,9 +720,9 @@ class Editor extends View
selectedText = @getSelectedText()
@hiddenInput.css('width', '100%')
@hiddenInput.on 'compositionupdate', (e) =>
@insertText(e.originalEvent.data, {select: true, skipUndo: true})
@insertText(e.originalEvent.data, {select: true, undo: 'skip'})
@hiddenInput.on 'compositionend', =>
@insertText(selectedText, {select: true, skipUndo: true})
@insertText(selectedText, {select: true, undo: 'skip'})
@hiddenInput.css('width', '1px')
lastInput = ''

View File

@@ -1,5 +1,6 @@
{Range} = require 'telepath'
{Emitter} = require 'emissary'
{pick} = require 'underscore'
# Public: Represents a selection in the {EditSession}.
module.exports =
@@ -297,8 +298,8 @@ class Selection
# + autoDecreaseIndent:
# if `true`, decreases indent level appropriately (for example, when a
# closing bracket is inserted)
# + skipUndo:
# if `true`, skips the undo stack for this operation.
# + undo:
# if `skip`, skips the undo stack for this operation.
insertText: (text, options={}) ->
oldBufferRange = @getBufferRange()
@editSession.destroyFoldsContainingBufferRow(oldBufferRange.end.row)
@@ -309,7 +310,7 @@ class Selection
if options.indentBasis? and not options.autoIndent
text = @normalizeIndents(text, options.indentBasis)
newBufferRange = @editSession.buffer.change(oldBufferRange, text, skipUndo: options.skipUndo)
newBufferRange = @editSession.buffer.change(oldBufferRange, text, pick(options, 'undo'))
if options.select
@setBufferRange(newBufferRange, isReversed: wasReversed)
else