" Vimball Archiver by Charles E. Campbell UseVimball finish autoload/SwapText.vim [[[1 216 " SwapText.vim: Mappings to exchange text with the previously deleted text. " " DEPENDENCIES: " - ingo/err.vim autoload script " " Copyright: (C) 2007-2016 Ingo Karkat " The VIM LICENSE applies to this script; see ':help copyright'. " " Maintainer: Ingo Karkat " " REVISION DATE REMARKS " 1.02.021 18-Sep-2016 BUG: When deleting at the end of a line, and " swapping with a longer text before it, the swap " location is off by one. The EOL position isn't " properly detected, because the virtual line " length after the paste is used in the condition. " Save the deleted virtual line length in " deletedVirtLen, and pass that on to " s:WasDeletionAtEndOfLine(). Thanks to Marcelo " Montu for the bug report. " 1.02.020 04-Feb-2015 "E790: undojoin is not allowed after undo" may " also be raised in SwapText#Operator(); ignore " it. " 1.00.019 24-Jun-2014 Prepare for publishing. " 018 05-May-2014 Abort on error. " 017 21-Mar-2013 Avoid changing the jumplist. " 016 19-Mar-2013 Handle deletion at the end of a line by checking " for the delete cursor position being at the end " of the line and (via the stored " s:deletedStartPos, as the '[ mark gets " clobbered) whether the deletion actually started " after it. " 015 28-Aug-2012 For the operators, handle readonly and " nomodifiable buffers by printing just the " warning / error, without the multi-line function " error. (Unlikely as it may be, as the user must " have done a delete first, anyway.) " 014 17-Nov-2011 ENH: Handle :undojoin failure when user did undo " between delete and swap. To avoid a potential " swap with wrong register contents, error in this " case. " FIX: Require Vim 7, necessary for :undojoin. " Rename to SwapText.vim. " Split off autoload script and documentation. " 013 30-Sep-2011 Use for mapping instead of " default mapping. " 012 22-Jun-2011 BUG: Must adapt the deleted line location if " it's below the overridden range; the override " may have changed the number of lines. " 011 16-Jun-2011 Remove general "P" command from pasteCmd " argument and rename it selectReplacementCmd. " Remove outdated comment. " 010 12-Feb-2010 After further problems with the used marks, set " jumps, etc., replaced all used marks with a " variable, and was even able to simplify the code " through it. " ENH: The swap is now atomic, i.e. it can be " undone in a single action. " 009 12-Feb-2010 BUG: Used mark ' instead of mark ", thereby " horribly breaking everything. (It's astounding " how long it took me to notice!) " 008 11-Sep-2009 BUG: Cannot set mark " in Vim 7.0 and 7.1; using " mark z instead; abstracted mark via s:tempMark. " 007 04-Jul-2009 Also replacing temporary mark ` with mark " and " using g` command for the visual mode swap. " 006 18-Jun-2009 Replaced temporary mark z with mark " and using " g` command to avoid clobbering jumplist. " 005 21-Mar-2009 Added \xx mapping for linewise swap. " Added \X mapping for swap until the end of line. " 004 07-Aug-2008 hasmapto() now checks for normal mode. " 003 30-Jun-2008 Removed unnecessary