Skip to content

Commit b1e04fc

Browse files
committed
patch 8.0.0516: a large count on a normal command causes trouble
Problem: A large count on a normal command causes trouble. (Dominique Pelle) Solution: Make "opcount" long.
1 parent d5d3753 commit b1e04fc

3 files changed

Lines changed: 31 additions & 21 deletions

File tree

src/globals.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,10 +932,10 @@ EXTERN int State INIT(= NORMAL); /* This is the current state of the
932932
* command interpreter. */
933933

934934
EXTERN int finish_op INIT(= FALSE);/* TRUE while an operator is pending */
935-
EXTERN int opcount INIT(= 0); /* count for pending operator */
935+
EXTERN long opcount INIT(= 0); /* count for pending operator */
936936

937937
/*
938-
* ex mode (Q) state
938+
* Ex mode (Q) state
939939
*/
940940
EXTERN int exmode_active INIT(= 0); /* zero, EXMODE_NORMAL or EXMODE_VIM */
941941
EXTERN int ex_no_reprint INIT(= FALSE); /* no need to print after z or p */

src/testdir/test_normal.vim

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,26 +2259,34 @@ func! Test_normal53_digraph()
22592259
bw!
22602260
endfunc
22612261

2262-
func! Test_normal54_Ctrl_bsl()
2263-
new
2264-
call setline(1, 'abcdefghijklmn')
2265-
exe "norm! df\<c-\>\<c-n>"
2266-
call assert_equal(['abcdefghijklmn'], getline(1,'$'))
2267-
exe "norm! df\<c-\>\<c-g>"
2268-
call assert_equal(['abcdefghijklmn'], getline(1,'$'))
2269-
exe "norm! df\<c-\>m"
2270-
call assert_equal(['abcdefghijklmn'], getline(1,'$'))
2262+
func Test_normal54_Ctrl_bsl()
2263+
new
2264+
call setline(1, 'abcdefghijklmn')
2265+
exe "norm! df\<c-\>\<c-n>"
2266+
call assert_equal(['abcdefghijklmn'], getline(1,'$'))
2267+
exe "norm! df\<c-\>\<c-g>"
2268+
call assert_equal(['abcdefghijklmn'], getline(1,'$'))
2269+
exe "norm! df\<c-\>m"
2270+
call assert_equal(['abcdefghijklmn'], getline(1,'$'))
22712271
if !has("multi_byte")
22722272
return
22732273
endif
2274-
call setline(2, 'abcdefghijklmnāf')
2275-
norm! 2gg0
2276-
exe "norm! df\<Char-0x101>"
2277-
call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$'))
2278-
norm! 1gg0
2279-
exe "norm! df\<esc>"
2280-
call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$'))
2281-
2282-
" clean up
2283-
bw!
2274+
call setline(2, 'abcdefghijklmnāf')
2275+
norm! 2gg0
2276+
exe "norm! df\<Char-0x101>"
2277+
call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$'))
2278+
norm! 1gg0
2279+
exe "norm! df\<esc>"
2280+
call assert_equal(['abcdefghijklmn', 'f'], getline(1,'$'))
2281+
2282+
" clean up
2283+
bw!
2284+
endfunc
2285+
2286+
func Test_normal_large_count()
2287+
" This may fail with 32bit long, how do we detect that?
2288+
new
2289+
normal o
2290+
normal 6666666666dL
2291+
bwipe!
22842292
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
516,
767769
/**/
768770
515,
769771
/**/

0 commit comments

Comments
 (0)