mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Skip the undo stack when changing composition text.
This commit is contained in:
@@ -705,9 +705,9 @@ class Editor extends View
|
||||
@hiddenInput.on 'compositionstart', =>
|
||||
@hiddenInput.css('width', '100%')
|
||||
@hiddenInput.on 'compositionupdate', (e) =>
|
||||
@insertText(e.originalEvent.data, select: true)
|
||||
@insertText(e.originalEvent.data, {select: true, skipUndo: true})
|
||||
@hiddenInput.on 'compositionend', =>
|
||||
@delete()
|
||||
@insertText('', skipUndo: true)
|
||||
@hiddenInput.css('width', '1px')
|
||||
|
||||
selectOnMousemoveUntilMouseup: ->
|
||||
|
||||
@@ -296,6 +296,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.
|
||||
insertText: (text, options={}) ->
|
||||
oldBufferRange = @getBufferRange()
|
||||
@editSession.destroyFoldsContainingBufferRow(oldBufferRange.end.row)
|
||||
@@ -306,7 +308,7 @@ class Selection
|
||||
if options.indentBasis? and not options.autoIndent
|
||||
text = @normalizeIndents(text, options.indentBasis)
|
||||
|
||||
newBufferRange = @editSession.buffer.change(oldBufferRange, text)
|
||||
newBufferRange = @editSession.buffer.change(oldBufferRange, text, skipUndo: options.skipUndo)
|
||||
if options.select
|
||||
@setBufferRange(newBufferRange, isReversed: wasReversed)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user