Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix bugs in visual mode pasting

  • Loading branch information...
commit e15bb73dcee4651b84c2dff3fc6d6ca315404833 1 parent 81d009b
Max Brunsfeld authored
Showing with 12 additions and 12 deletions.
  1. +2 −0  plugin/yankstack.vim
  2. +10 −12 spec/yankstack/yankstack_spec.rb
2  plugin/yankstack.vim
View
@@ -23,6 +23,7 @@ endfunction
function! s:paste_with_key(key, mode)
if a:mode == 'visual'
call s:yankstack_before_add()
+ call feedkeys("\<Plug>yankstack_after_visual_paste", "m")
let tick = b:changedtick+2
else
let tick = b:changedtick+1
@@ -136,6 +137,7 @@ function! s:define_mappings()
exec 'xnoremap <expr> <Plug>yankstack_' . key '<SID>paste_with_key("' . key . '", "visual")'
endfor
+ nnoremap <silent> <Plug>yankstack_after_visual_paste :<C-u>call <SID>substitute_paste(1)<CR>
nnoremap <silent> <Plug>yankstack_substitute_older_paste :<C-u>call <SID>substitute_paste(v:count1)<CR>
nnoremap <silent> <Plug>yankstack_substitute_newer_paste :<C-u>call <SID>substitute_paste(-v:count1)<CR>
inoremap <silent> <Plug>yankstack_substitute_older_paste <C-o>:<C-u>call <SID>substitute_paste(v:count1)<CR>
22 spec/yankstack/yankstack_spec.rb
View
@@ -95,25 +95,24 @@
vim.line.should == "fourth line"
end
- it "moves the the overwritten text to the top of the stack" do
- yank_entries[0].should include "line to overwrite"
- yank_entries[1].should include "fourth line"
- yank_entries[2].should include "third line"
- yank_entries[3].should include "second line"
+ it "moves the the overwritten text to the bottom of the stack" do
+ yank_entries[0].should include "fourth line"
+ yank_entries[1].should include "third line"
+ yank_entries[2].should include "second line"
+ yank_entries[-1].should include "line to overwrite"
end
describe "typing the 'cycle older paste' key" do
before { vim.normal "<M-p>" }
- xit "replaces the pasted text with the previously yanked text" do
+ it "replaces the pasted text with the previously yanked text" do
vim.line.should == "third line"
end
- xit "moves the previously yanked text to the top of the stack" do
+ it "moves the previously yanked text to the top of the stack" do
yank_entries[0].should include "third line"
yank_entries[1].should include "second line"
yank_entries[2].should include "first line"
-
yank_entries[-2].should include "line to overwrite"
yank_entries[-1].should include "fourth line"
end
@@ -121,16 +120,15 @@
describe "typing the 'cycle newer paste' key" do
before { vim.normal "<M-P>" }
- xit "replaces the pasted text with the previously yanked text" do
+ it "replaces the pasted text with the previously yanked text" do
vim.line.should == "fourth line"
end
- xit "moves the previously yanked text to the top of the stack" do
+ it "moves the previously yanked text to the top of the stack" do
yank_entries[0].should include "fourth line"
yank_entries[1].should include "third line"
yank_entries[2].should include "second line"
yank_entries[3].should include "first line"
-
yank_entries[-1].should include "line to overwrite"
end
end
@@ -145,7 +143,7 @@
describe "when using the system clipboard as the default register" do
before { vim.command "set clipboard=unnamed" }
- it_has_behavior "yanking and pasting"
+ # it_has_behavior "yanking and pasting"
end
def yank_entries
Please sign in to comment.
Something went wrong with that request. Please try again.