diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-09-10 01:14:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-10 01:14:18 -0700 |
commit | 5d7853f22903a4f42d52f565f6a662c3ef178a8c (patch) | |
tree | 9329edaa4dc694186644a5a9e3f405eb365e8ae8 /src/nvim/getchar.c | |
parent | f279d1ae33ee5650bccf7b52f9f29fd192ccea1d (diff) | |
download | rneovim-5d7853f22903a4f42d52f565f6a662c3ef178a8c.tar.gz rneovim-5d7853f22903a4f42d52f565f6a662c3ef178a8c.tar.bz2 rneovim-5d7853f22903a4f42d52f565f6a662c3ef178a8c.zip |
refactor(os/input.c): rename os_inchar => input_get #30327
Problem:
The name `os_inchar` (from Vim's old `mch_inchar`) is ambiguous:
"inchar" sounds like it could be reading or enqueuing (setting) input.
Its docstring is also ambiguous.
Solution:
- Rename `os_inchar` to `input_get`.
- Write some mf'ing docstrings.
- Add assert() in TRY_READ().
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 7b388e6061..ba0b629896 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1858,7 +1858,7 @@ static void getchar_common(typval_T *argvars, typval_T *rettv) if (!char_avail()) { // Flush screen updates before blocking. ui_flush(); - os_inchar(NULL, 0, -1, typebuf.tb_change_cnt, main_loop.events); + input_get(NULL, 0, -1, typebuf.tb_change_cnt, main_loop.events); if (!multiqueue_empty(main_loop.events)) { state_handle_k_event(); continue; @@ -2981,7 +2981,7 @@ int inchar(uint8_t *buf, int maxlen, long wait_time) uint8_t dum[DUM_LEN + 1]; while (true) { - len = os_inchar(dum, DUM_LEN, 0, 0, NULL); + len = input_get(dum, DUM_LEN, 0, 0, NULL); if (len == 0 || (len == 1 && dum[0] == Ctrl_C)) { break; } @@ -2997,7 +2997,7 @@ int inchar(uint8_t *buf, int maxlen, long wait_time) // Fill up to a third of the buffer, because each character may be // tripled below. - len = os_inchar(buf, maxlen / 3, (int)wait_time, tb_change_cnt, NULL); + len = input_get(buf, maxlen / 3, (int)wait_time, tb_change_cnt, NULL); } // If the typebuf was changed further down, it is like nothing was added by |