comparison src/testdir/test_normal.vim @ 17520:827d29c8f7e8 v8.1.1758

patch 8.1.1758: count of g$ not used correctly when text is not wrapped commit https://github.com/vim/vim/commit/d5c8234517c18fa059b78f59eb96c35eda323dae Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 27 18:44:57 2019 +0200 patch 8.1.1758: count of g$ not used correctly when text is not wrapped Problem: Count of g$ not used correctly when text is not wrapped. Solution: Do use the count. (Christian Brabandt, closes https://github.com/vim/vim/issues/4729, closes https://github.com/vim/vim/issues/4566)
author Bram Moolenaar <Bram@vim.org>
date Sat, 27 Jul 2019 19:00:05 +0200
parents 6990c1160ea5
children 3dbff5d37520
comparison
equal deleted inserted replaced
17519:88eefa30af20 17520:827d29c8f7e8
2730 call assert_equal("{LF", getline('.')) 2730 call assert_equal("{LF", getline('.'))
2731 call assert_equal([2, 2, 2], [line('.'), col('.'), virtcol('.')]) 2731 call assert_equal([2, 2, 2], [line('.'), col('.'), virtcol('.')])
2732 2732
2733 close! 2733 close!
2734 endfunc 2734 endfunc
2735
2736 fun! Test_normal_gdollar_cmd()
2737 if !has("jumplist")
2738 return
2739 endif
2740 " Tests for g cmds
2741 call Setup_NewWindow()
2742 " Make long lines that will wrap
2743 %s/$/\=repeat(' foobar', 10)/
2744 20vsp
2745 set wrap
2746 " Test for g$ with count
2747 norm! gg
2748 norm! 0vg$y
2749 call assert_equal(20, col("'>"))
2750 call assert_equal('1 foobar foobar foob', getreg(0))
2751 norm! gg
2752 norm! 0v4g$y
2753 call assert_equal(72, col("'>"))
2754 call assert_equal('1 foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar'.."\n", getreg(0))
2755 norm! gg
2756 norm! 0v6g$y
2757 call assert_equal(40, col("'>"))
2758 call assert_equal('1 foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar'.. "\n"..
2759 \ '2 foobar foobar foobar foobar foobar foo', getreg(0))
2760 set nowrap
2761 " clean up
2762 norm! gg
2763 norm! 0vg$y
2764 call assert_equal(20, col("'>"))
2765 call assert_equal('1 foobar foobar foob', getreg(0))
2766 norm! gg
2767 norm! 0v4g$y
2768 call assert_equal(20, col("'>"))
2769 call assert_equal('1 foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar'.. "\n"..
2770 \ '2 foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar'.. "\n"..
2771 \ '3 foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar'.. "\n"..
2772 \ '4 foobar foobar foob', getreg(0))
2773 norm! gg
2774 norm! 0v6g$y
2775 call assert_equal(20, col("'>"))
2776 call assert_equal('1 foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar'.. "\n"..
2777 \ '2 foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar'.. "\n"..
2778 \ '3 foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar'.. "\n"..
2779 \ '4 foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar'.. "\n"..
2780 \ '5 foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar'.. "\n"..
2781 \ '6 foobar foobar foob', getreg(0))
2782 " Move to last line, also down movement is not possible, should still move
2783 " the cursor to the last visible char
2784 norm! G
2785 norm! 0v6g$y
2786 call assert_equal(20, col("'>"))
2787 call assert_equal('100 foobar foobar fo', getreg(0))
2788 bw!
2789 endfunc