 class Undo extends MiscCommand
   @extend()
 
+  # Trim starting new-line-corresponding range if it transformed range become linewise range.
+  # this is special accomodation for flashing intuitively for human when `y y p` then `undo`, `redo`
+  trimStartingNewLine: (range) ->
+    {start, end} = range
+    if (end.column is 0) and (start.row + 1 isnt end.row) and pointIsAtEndOfLine(@editor, start)
+      new Range([start.row + 1, 0], end)
+    else
+      range
+
   withTrackingChanges: (fn) ->
     newRanges = []
     oldRanges = []
 
-    disposable = @editor.getBuffer().onDidChange (event) ->
-      {oldRange, newRange, oldText, newText} = event
-
+    disposable = @editor.getBuffer().onDidChange ({oldRange, newRange}) ->
       if newRange.containsRange(oldRange)
         newRanges.push(newRange)
         return

        @editor.setCursorBufferPosition(range.start)

    if settings.get('flashOnUndoRedo')
      @onDidFinishOperation =>
        @vimState.flash(oldRanges, type: 'removed')
        @vimState.flash(newRanges, type: 'added')

  execute: ->
    @withTrackingChanges =>

    fn()

    disposable.dispose()

    if range = sortRanges(_.compact([newRanges[0], _.last(oldRanges)]))[0]
      @vimState.mark.setRange('[', ']', range)
