|
|
13ea7f |
diff --git a/src/errors.h b/src/errors.h
|
|
|
13ea7f |
index 3008020..3daf1a6 100644
|
|
|
13ea7f |
--- a/src/errors.h
|
|
|
13ea7f |
+++ b/src/errors.h
|
|
|
13ea7f |
@@ -381,3 +381,5 @@ EXTERN char e_missing_end_block[]
|
|
|
13ea7f |
INIT(= N_("E1171: Missing } after inline function"));
|
|
|
13ea7f |
EXTERN char e_cannot_use_default_values_in_lambda[]
|
|
|
13ea7f |
INIT(= N_("E1172: Cannot use default values in a lambda"));
|
|
|
13ea7f |
+EXTERN char e_resulting_text_too_long[]
|
|
|
13ea7f |
+ INIT(= N_("E1240: Resulting text too long"));
|
|
|
13ea7f |
diff --git a/src/indent.c b/src/indent.c
|
|
|
13ea7f |
index 4f909d0..77d8b0a 100644
|
|
|
13ea7f |
--- a/src/indent.c
|
|
|
13ea7f |
+++ b/src/indent.c
|
|
|
13ea7f |
@@ -1696,6 +1696,11 @@ ex_retab(exarg_T *eap)
|
|
|
13ea7f |
if (ptr[col] == NUL)
|
|
|
13ea7f |
break;
|
|
|
13ea7f |
vcol += chartabsize(ptr + col, (colnr_T)vcol);
|
|
|
13ea7f |
+ if (vcol >= MAXCOL)
|
|
|
13ea7f |
+ {
|
|
|
13ea7f |
+ emsg(_(e_resulting_text_too_long));
|
|
|
13ea7f |
+ break;
|
|
|
13ea7f |
+ }
|
|
|
13ea7f |
if (has_mbyte)
|
|
|
13ea7f |
col += (*mb_ptr2len)(ptr + col);
|
|
|
13ea7f |
else
|
|
|
13ea7f |
diff --git a/src/testdir/test_retab.vim b/src/testdir/test_retab.vim
|
|
|
13ea7f |
index c7190aa..6133e8f 100644
|
|
|
13ea7f |
--- a/src/testdir/test_retab.vim
|
|
|
13ea7f |
+++ b/src/testdir/test_retab.vim
|
|
|
13ea7f |
@@ -70,6 +70,8 @@ func Test_retab()
|
|
|
13ea7f |
call assert_equal(" a b c ", Retab('!', 3))
|
|
|
13ea7f |
call assert_equal(" a b c ", Retab('', 5))
|
|
|
13ea7f |
call assert_equal(" a b c ", Retab('!', 5))
|
|
|
13ea7f |
+
|
|
|
13ea7f |
+ set tabstop& expandtab&
|
|
|
13ea7f |
endfunc
|
|
|
13ea7f |
|
|
|
13ea7f |
func Test_retab_error()
|
|
|
13ea7f |
@@ -80,4 +82,21 @@ func Test_retab_error()
|
|
|
13ea7f |
call assert_fails('ret 80000000000000000000', 'E475:')
|
|
|
13ea7f |
endfunc
|
|
|
13ea7f |
|
|
|
13ea7f |
+func Test_retab_endless()
|
|
|
13ea7f |
+ new
|
|
|
13ea7f |
+ call setline(1, "\t0\t")
|
|
|
13ea7f |
+ let caught = 'no'
|
|
|
13ea7f |
+ try
|
|
|
13ea7f |
+ while 1
|
|
|
13ea7f |
+ set ts=4000
|
|
|
13ea7f |
+ retab 4
|
|
|
13ea7f |
+ endwhile
|
|
|
13ea7f |
+ catch /E1240/
|
|
|
13ea7f |
+ let caught = 'yes'
|
|
|
13ea7f |
+ endtry
|
|
|
13ea7f |
+ bwipe!
|
|
|
13ea7f |
+ set tabstop&
|
|
|
13ea7f |
+endfunc
|
|
|
13ea7f |
+
|
|
|
13ea7f |
+
|
|
|
13ea7f |
" vim: shiftwidth=2 sts=2 expandtab
|