Fix bugs related to 'ignorecase' and 'clipboard'

This commit is contained in:
Tim Pope
2008-04-25 18:31:09 -05:00
parent b50ce89362
commit 298858f6a2

View File

@@ -159,7 +159,7 @@ function! s:wrap(string,char,type,...)
let special = a:0 ? a:1 : 0 let special = a:0 ? a:1 : 0
let before = "" let before = ""
let after = "" let after = ""
if type == "V" if type ==# "V"
let initspaces = matchstr(keeper,'\%^\s*') let initspaces = matchstr(keeper,'\%^\s*')
else else
let initspaces = matchstr(getline('.'),'\%^\s*') let initspaces = matchstr(getline('.'),'\%^\s*')
@@ -350,6 +350,7 @@ function! s:insert(...) " {{{1
endif endif
"call inputsave() "call inputsave()
let cb_save = &clipboard let cb_save = &clipboard
set clipboard-=unnamed
let reg_save = @@ let reg_save = @@
call setreg('"',"\r",'v') call setreg('"',"\r",'v')
call s:wrapreg('"',char,linemode) call s:wrapreg('"',char,linemode)
@@ -525,11 +526,14 @@ function! s:opfunc(type,...) " {{{1
silent exe 'norm! `[V`]"'.reg.'y' silent exe 'norm! `[V`]"'.reg.'y'
let type = 'V' let type = 'V'
elseif a:type ==# "v" || a:type ==# "V" || a:type ==# "\<C-V>" elseif a:type ==# "v" || a:type ==# "V" || a:type ==# "\<C-V>"
let ve = &virtualedit
set virtualedit=
silent exe 'norm! gv"'.reg.'y' silent exe 'norm! gv"'.reg.'y'
let &virtualedit = ve
elseif a:type =~ '^\d\+$' elseif a:type =~ '^\d\+$'
let type = 'v' let type = 'v'
silent exe 'norm! ^v'.a:type.'$h"'.reg.'y' silent exe 'norm! ^v'.a:type.'$h"'.reg.'y'
if mode() == 'v' if mode() ==# 'v'
norm! v norm! v
return s:beep() return s:beep()
endif endif
@@ -539,17 +543,17 @@ function! s:opfunc(type,...) " {{{1
return s:beep() return s:beep()
endif endif
let keeper = getreg(reg) let keeper = getreg(reg)
if type == "v" && a:type != "v" if type ==# "v" && a:type !=# "v"
let append = matchstr(keeper,'\_s\@<!\s*$') let append = matchstr(keeper,'\_s\@<!\s*$')
let keeper = substitute(keeper,'\_s\@<!\s*$','','') let keeper = substitute(keeper,'\_s\@<!\s*$','','')
endif endif
call setreg(reg,keeper,type) call setreg(reg,keeper,type)
call s:wrapreg(reg,char,a:0) call s:wrapreg(reg,char,a:0)
if type == "v" && a:type != "v" && append != "" if type ==# "v" && a:type !=# "v" && append != ""
call setreg(reg,append,"ac") call setreg(reg,append,"ac")
endif endif
silent exe 'norm! gv'.(reg == '"' ? '' : '"' . reg).'p`[' silent exe 'norm! gv'.(reg == '"' ? '' : '"' . reg).'p`['
if type == 'V' || (getreg(reg) =~ '\n' && type == 'v') if type ==# 'V' || (getreg(reg) =~ '\n' && type ==# 'v')
call s:reindent() call s:reindent()
endif endif
call setreg(reg,reg_save,reg_type) call setreg(reg,reg_save,reg_type)