remove disable_char_avail_for_testing()

test_cursor_func.vim hangs at the call to
disable_char_avail_for_testing(). The test does not actually need this
function (and it correctly fails if the fix from 7.4.1300 is reverted).
Given that disable_char_avail_for_testing is a gigantic hack, if we can
avoid it let's do so.
This commit is contained in:
Justin M. Keyes 2016-04-26 23:29:55 -04:00
parent 0d6fe73d7b
commit e4146dd7df
6 changed files with 1 additions and 28 deletions

View File

@ -1839,7 +1839,6 @@ dictwatcherdel( {dict}, {pattern}, {callback})
did_filetype() Number TRUE if FileType autocommand event used
diff_filler( {lnum}) Number diff filler lines about {lnum}
diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col}
disable_char_avail_for_testing({expr}) none test without typeahead
empty( {expr}) Number TRUE if {expr} is empty
escape( {string}, {chars}) String escape {chars} in {string} with '\'
eval( {string}) any evaluate {string} into its value
@ -2868,13 +2867,6 @@ diff_hlID({lnum}, {col}) *diff_hlID()*
The highlight ID can be used with |synIDattr()| to obtain
syntax information about the highlighting.
disable_char_avail_for_testing({expr})
When {expr} is 1 the internal char_avail() function will
return FALSE. When {expr} is 0 the char_avail() function will
function normally.
Only use this for a test where typeahead causes the test not
to work. E.g., to trigger the CursorMovedI autocommand event.
empty({expr}) *empty()*
Return the Number 1 if {expr} is empty, zero otherwise.
A |List| or |Dictionary| is empty when it does not have any

View File

@ -6708,7 +6708,6 @@ static struct fst {
{ "did_filetype", 0, 0, f_did_filetype },
{ "diff_filler", 1, 1, f_diff_filler },
{ "diff_hlID", 2, 2, f_diff_hlID },
{ "disable_char_avail_for_testing", 1, 1, f_disable_char_avail_for_testing },
{ "empty", 1, 1, f_empty },
{ "escape", 2, 2, f_escape },
{ "eval", 1, 1, f_eval },
@ -8604,15 +8603,6 @@ static void f_diff_hlID(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = hlID == (hlf_T)0 ? 0 : (int)hlID;
}
//
// "disable_char_avail_for_testing({expr})" function
//
static void f_disable_char_avail_for_testing(typval_T *argvars, typval_T *rettv)
FUNC_ATTR_NONNULL_ARG(1)
{
disable_char_avail_for_testing = get_tv_number(&argvars[0]);
}
/*
* "empty({expr})" function
*/

View File

@ -1562,11 +1562,6 @@ int char_avail(void)
{
int retval;
// When disable_char_avail_for_testing(1) was called pretend
// there is no typeahead
if (disable_char_avail_for_testing) {
return false;
}
no_mapping++;
retval = vpeekc();
--no_mapping;

View File

@ -1239,8 +1239,6 @@ EXTERN FILE *time_fd INIT(= NULL); /* where to write startup timing */
EXTERN int ignored;
EXTERN char *ignoredp;
EXTERN int disable_char_avail_for_testing INIT(= 0);
// If a msgpack-rpc channel should be started over stdin/stdout
EXTERN bool embedded_mode INIT(= false);
EXTERN Loop loop;

View File

@ -44,9 +44,7 @@ func Test_curswant_with_autocommand()
new
call setline(1, ['func()', '{', '}', '----'])
autocmd! CursorMovedI * call s:Highlight_Matching_Pair()
call disable_char_avail_for_testing(1)
exe "normal! 3Ga\<Down>X\<Esc>"
call disable_char_avail_for_testing(0)
call assert_equal('-X---', getline(4))
autocmd! CursorMovedI *
quit!

View File

@ -377,7 +377,7 @@ static int included_patches[] = {
// 1303 NA
// 1302 NA
// 1301 NA
1300,
// 1300 NA
// 1299 NA
// 1298 NA
// 1297 NA