return TRUE;
}
+/*
+ * Give a "resulting text too long" error and maybe set got_int.
+ */
+ static void
+emsg_text_too_long(void)
+{
+ emsg(_(e_resulting_text_too_long));
+#ifdef FEAT_EVAL
+ // when not inside a try/catch set got_int to break out of any loop
+ if (trylevel == 0)
+#endif
+ got_int = TRUE;
+}
+
/*
* ":retab".
*/
new_len = old_len - col + start_col + len + 1;
if (new_len <= 0 || new_len >= MAXCOL)
{
- emsg(_(e_resulting_text_too_long));
+ emsg_text_too_long();
break;
}
new_line = alloc(new_len);
vcol += chartabsize(ptr + col, (colnr_T)vcol);
if (vcol >= MAXCOL)
{
- emsg(_(e_resulting_text_too_long));
- // when not inside a try/catch set got_int to break out of any
- // loop
-#ifdef FEAT_EVAL
- if (trylevel == 0)
-#endif
- got_int = TRUE;
+ emsg_text_too_long();
break;
}
if (has_mbyte)
endfunc
func Test_retab_endless()
- " inside try/catch we catch the error message
+ " inside try/catch we can catch the error message
call setline(1, "\t0\t")
let caught = 'no'
try
endfunc
func Test_nocatch_retab_endless()
- " FIXME: why does this hang on MS-Windows? Is got_int reset somewhere?
- if has('win32')
- let g:skipped_reason = "does not work on MS-Windows"
- return
- endif
-
- " not inside try/catch an interrupt is generated to get out of loops
+ " when not inside try/catch an interrupt is generated to get out of loops
call setline(1, "\t0\t")
call assert_fails('call RetabLoop()', ['E1240:', 'Interrupted'])