Permalink
Browse files

Specs for visual mode

Unfortunately, something's not quite right with visual mode. Need to
investigate.
  • Loading branch information...
AndrewRadev committed Dec 1, 2012
1 parent 9cf253d commit 885335e334cf8a459a8e43ef8119f57861644147
Showing with 34 additions and 3 deletions.
  1. +3 −3 plugin/whitespaste.vim
  2. +25 −0 spec/plugin/visual_mode_spec.rb
  3. +6 −0 spec/support/vim.rb
View
@@ -56,9 +56,9 @@ autocmd FileType vim let b:whitespaste_linewise_definitions = {
\ ]
\ }
-command! WhitespasteBefore :call whitespaste#Paste(g:whitespaste_paste_before_command)
-command! WhitespasteAfter :call whitespaste#Paste(g:whitespaste_paste_after_command)
-command! -range WhitespasteVisual :call whitespaste#Paste(g:whitespaste_paste_visual_command)
+command! WhitespasteBefore call whitespaste#Paste(g:whitespaste_paste_before_command)
+command! WhitespasteAfter call whitespaste#Paste(g:whitespaste_paste_after_command)
+command! -range WhitespasteVisual call whitespaste#Paste(g:whitespaste_paste_visual_command)
nmap <Plug>WhitespasteBefore :WhitespasteBefore<cr>
nmap <Plug>WhitespasteAfter :WhitespasteAfter<cr>
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+describe "Visual mode" do
+ let(:filename) { 'test.txt' }
+ let(:vim) { @vim }
+
+ xit "compresses multiple blank lines" do
+ set_file_contents <<-EOF
+ one
+
+
+ two
+ EOF
+
+ vim.normal 'V2jy'
+ vim.search 'two'
+ vim.whitespaste_visual
+
+ assert_file_contents <<-EOF
+ one
+
+ one
+ EOF
+ end
+end
View
@@ -12,6 +12,12 @@ def vim.whitespaste_after
write
self
end
+
+ def vim.whitespaste_visual
+ normal 'V:WhitespasteVisual<cr>'
+ write
+ self
+ end
end
end
end

0 comments on commit 885335e

Please sign in to comment.