1
0
forked from aniani/vim

patch 9.1.1068: getchar() can't distinguish between C-I and Tab

Problem:  getchar() can't distinguish between C-I and Tab.
Solution: Add {opts} to pass extra flags to getchar() and getcharstr(),
          with "number" and "simplify" keys.

related: #10603
closes: #16554

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-02-02 09:14:35 +01:00
committed by Christian Brabandt
parent cbc1f409c1
commit e0a2ab397f
9 changed files with 198 additions and 52 deletions

View File

@@ -526,6 +526,20 @@ check_for_bool_arg(typval_T *args, int idx)
return OK;
}
/*
* Give an error and return FAIL unless "args[idx]" is a bool or a number.
*/
int
check_for_bool_or_number_arg(typval_T *args, int idx)
{
if (args[idx].v_type != VAR_BOOL && args[idx].v_type != VAR_NUMBER)
{
semsg(_(e_bool_or_number_required_for_argument_nr), idx + 1);
return FAIL;
}
return OK;
}
/*
* Check for an optional bool argument at 'idx'.
* Return FAIL if the type is wrong.
@@ -538,6 +552,18 @@ check_for_opt_bool_arg(typval_T *args, int idx)
return check_for_bool_arg(args, idx);
}
/*
* Check for an optional bool or number argument at 'idx'.
* Return FAIL if the type is wrong.
*/
int
check_for_opt_bool_or_number_arg(typval_T *args, int idx)
{
if (args[idx].v_type == VAR_UNKNOWN)
return OK;
return check_for_bool_or_number_arg(args, idx);
}
/*
* Give an error and return FAIL unless "args[idx]" is a blob.
*/