view runtime/autoload/paste.vim @ 33982:63341afcd329 v9.0.2177

patch 9.0.2177: Wrong cursor position when dragging out of window Commit: https://github.com/vim/vim/commit/ec14924368e23f2430815c009bd554f88de9c57f Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Dec 19 20:28:31 2023 +0100 patch 9.0.2177: Wrong cursor position when dragging out of window Problem: Wrong cursor position when dragging out of window. Solution: Don't use ScreenCols[] when mouse is not in current window. closes: #13717 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 19 Dec 2023 20:30:09 +0100
parents 4027cefc2aab
children
line wrap: on
line source

" Vim support file to help with paste mappings and menus
" Maintainer:	The Vim Project <https://github.com/vim/vim>
" Last Change:	2023 Aug 10
" Former Maintainer:	Bram Moolenaar <Bram@vim.org>

" Define the string to use for items that are present both in Edit, Popup and
" Toolbar menu.  Also used in mswin.vim and macmap.vim.

let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"

func! paste#Paste()
  let ove = &ve
  set ve=all
  normal! `^
  if @+ != ''
    normal! "+gP
  endif
  let c = col(".")
  normal! i
  if col(".") < c	" compensate for i<ESC> moving the cursor left
    normal! l
  endif
  let &ve = ove
endfunc