I want to create a macro that, after pasting the clipboard (ala Ctrl-V), returns the cursor to the location of the of the cursor at the start of a paste, rather than at the end of what was pasted:
Normal paste leaves cursor here
v
|this_is_pasted_text
^
I want cursor here after the paste.
(BTW, if there already is a setting for this, I'll take that as well)
I tried the following:
_command paste_stay(_str name='', boolean isClipboard=true) name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
typeless p;
_save_pos2(p);
int retval = paste(name, isClipboard);
_restore_pos2(p);
return retval;
}
However, the _restore_pos2() call placed the cursor at the end of the pasted text. It's as if the position value _save_pos2() returns is modified via the paste function to the "post-paste" location.
Is there anyway to obtain the "pre-paste" location, and return the cursor to that spot?
Thanks,
Chuck