]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.0516: a large count on a normal command causes trouble v8.0.0516
authorBram Moolenaar <Bram@vim.org>
Wed, 29 Mar 2017 11:08:35 +0000 (13:08 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 29 Mar 2017 11:08:35 +0000 (13:08 +0200)
Problem:    A large count on a normal command causes trouble. (Dominique
            Pelle)
Solution:   Make "opcount" long.

src/globals.h
src/testdir/test_normal.vim
src/version.c

index f8186630fa3cb01f3e3c80073194639f57e2a832..59193e07a7e2c7712a46966696d281e38bd44043 100644 (file)
@@ -932,10 +932,10 @@ EXTERN int        State INIT(= NORMAL);   /* This is the current state of the
                                         * command interpreter. */
 
 EXTERN int     finish_op INIT(= FALSE);/* TRUE while an operator is pending */
-EXTERN int     opcount INIT(= 0);      /* count for pending operator */
+EXTERN long    opcount INIT(= 0);      /* count for pending operator */
 
 /*
- * ex mode (Q) state
+ * Ex mode (Q) state
  */
 EXTERN int exmode_active INIT(= 0);    /* zero, EXMODE_NORMAL or EXMODE_VIM */
 EXTERN int ex_no_reprint INIT(= FALSE); /* no need to print after z or p */
index e0df0ae1ebe07f91b597f9110caea5a04583efb2..cbae8479ece1f0430a32f87df3c5a2ead4136cce 100644 (file)
@@ -2259,26 +2259,34 @@ func! Test_normal53_digraph()
   bw!
 endfunc
 
-func! Test_normal54_Ctrl_bsl()
-       new
-       call setline(1, 'abcdefghijklmn')
-       exe "norm! df\<c-\>\<c-n>"
-       call assert_equal(['abcdefghijklmn'], getline(1,'$'))
-       exe "norm! df\<c-\>\<c-g>"
-       call assert_equal(['abcdefghijklmn'], getline(1,'$'))
-       exe "norm! df\<c-\>m"
-       call assert_equal(['abcdefghijklmn'], getline(1,'$'))
+func Test_normal54_Ctrl_bsl()
+  new
+  call setline(1, 'abcdefghijklmn')
+  exe "norm! df\<c-\>\<c-n>"
+  call assert_equal(['abcdefghijklmn'], getline(1,'$'))
+  exe "norm! df\<c-\>\<c-g>"
+  call assert_equal(['abcdefghijklmn'], getline(1,'$'))
+  exe "norm! df\<c-\>m"
+  call assert_equal(['abcdefghijklmn'], getline(1,'$'))
   if !has("multi_byte")
     return
   endif
-       call setline(2, 'abcdefghijklmnāf')
-       norm! 2gg0
-       exe "norm! df\<Char-0x101>"
-       call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$'))
-       norm! 1gg0
-       exe "norm! df\<esc>"
-       call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$'))
-
-       " clean up
-       bw!
+  call setline(2, 'abcdefghijklmnāf')
+  norm! 2gg0
+  exe "norm! df\<Char-0x101>"
+  call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$'))
+  norm! 1gg0
+  exe "norm! df\<esc>"
+  call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$'))
+
+  " clean up
+  bw!
+endfunc
+
+func Test_normal_large_count()
+  " This may fail with 32bit long, how do we detect that?
+  new
+  normal o
+  normal 6666666666dL
+  bwipe!
 endfunc
index c114d8f55b55061cf9a003065cb14c5cbd04aeac..74dc550097b3bc0c4b47e118db4942a26dffc75c 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    516,
 /**/
     515,
 /**/