Mercurial > vim
changeset 22107:679269735ec3 v8.2.1603
patch 8.2.1603: Vim9: cannot use "true" with getchar()
Commit: https://github.com/vim/vim/commit/c08cc72947fdfab484f53c5d9bbea662bc5a9c8f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 5 17:51:23 2020 +0200
patch 8.2.1603: Vim9: cannot use "true" with getchar()
Problem: Vim9: cannot use "true" with getchar().
Solution: use tv_get_bool_chk(). (closes https://github.com/vim/vim/issues/6874)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 05 Sep 2020 18:00:04 +0200 |
parents | fbcfa658f056 |
children | 8647bba4ccc7 |
files | src/getchar.c src/testdir/test_vim9_func.vim src/version.c |
diffstat | 3 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/getchar.c +++ b/src/getchar.c @@ -2037,7 +2037,7 @@ f_getchar(typval_T *argvars, typval_T *r if (argvars[0].v_type == VAR_UNKNOWN) // getchar(): blocking wait. n = plain_vgetc(); - else if (tv_get_number_chk(&argvars[0], &error) == 1) + else if (tv_get_bool_chk(&argvars[0], &error)) // getchar(1): only check if char avail n = vpeekc_any(); else if (error || vpeekc_any() == NUL)