aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/getchar.c47
-rw-r--r--src/nvim/keymap.h4
-rw-r--r--src/nvim/testdir/test_filetype.vim3
3 files changed, 34 insertions, 20 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 419c6328ee..d70d04cb4b 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1096,26 +1096,40 @@ void del_typebuf(int len, int offset)
* Write typed characters to script file.
* If recording is on put the character in the recordbuffer.
*/
-static void gotchars(char_u *chars, size_t len)
+static void gotchars(const char_u *chars, size_t len)
+ FUNC_ATTR_NONNULL_ALL
{
- char_u *s = chars;
- int c;
+ const char_u *s = chars;
+ static char_u buf[4] = { 0 };
+ static size_t buflen = 0;
+ size_t todo = len;
- // remember how many chars were last recorded
- if (reg_recording != 0) {
- last_recorded_len += len;
- }
+ while (todo--) {
+ buf[buflen++] = *s++;
+
+ // When receiving a special key sequence, store it until we have all
+ // the bytes and we can decide what to do with it.
+ if (buflen == 1 && buf[0] == K_SPECIAL) {
+ continue;
+ }
+ if (buflen == 2) {
+ continue;
+ }
- while (len--) {
// Handle one byte at a time; no translation to be done.
- c = *s++;
- updatescript(c);
+ for (size_t i = 0; i < buflen; i++) {
+ updatescript(buf[i]);
+ }
if (reg_recording != 0) {
- char buf[2] = { (char)c, NUL };
- add_buff(&recordbuff, buf, 1L);
+ buf[buflen] = NUL;
+ add_buff(&recordbuff, (char *)buf, (ptrdiff_t)buflen);
+ // remember how many chars were last recorded
+ last_recorded_len += buflen;
}
+ buflen = 0;
}
+
may_sync_undo();
/* output "debug mode" message next time in debug mode */
@@ -2481,12 +2495,11 @@ int inchar(
return fix_input_buffer(buf, len);
}
-/*
- * Fix typed characters for use by vgetc() and check_termcode().
- * buf[] must have room to triple the number of bytes!
- * Returns the new length.
- */
+// Fix typed characters for use by vgetc() and check_termcode().
+// "buf[]" must have room to triple the number of bytes!
+// Returns the new length.
int fix_input_buffer(char_u *buf, int len)
+ FUNC_ATTR_NONNULL_ALL
{
if (!using_script()) {
// Should not escape K_SPECIAL/CSI reading input from the user because vim
diff --git a/src/nvim/keymap.h b/src/nvim/keymap.h
index cc02a6fb4f..d3e887badc 100644
--- a/src/nvim/keymap.h
+++ b/src/nvim/keymap.h
@@ -240,8 +240,8 @@ enum key_extra {
, KE_DROP = 95 // DnD data is available
// , KE_CURSORHOLD = 96 // CursorHold event
, KE_NOP = 97 // no-op: does nothing
- , KE_FOCUSGAINED = 98 // focus gained
- , KE_FOCUSLOST = 99 // focus lost
+ // , KE_FOCUSGAINED = 98 // focus gained
+ // , KE_FOCUSLOST = 99 // focus lost
// , KE_MOUSEMOVE = 100 // mouse moved with no button down
// , KE_CANCEL = 101 // return from vgetc
, KE_EVENT = 102 // event
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 2334cc95a7..7290cceb0b 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -139,7 +139,7 @@ let s:filename_checks = {
\ 'dockerfile': ['Dockerfile', 'file.Dockerfile'],
\ 'dosbatch': ['file.bat', 'file.sys'],
\ 'dosini': ['.editorconfig', '/etc/yum.conf', 'file.ini'],
- \ 'dot': ['file.dot'],
+ \ 'dot': ['file.dot', 'file.gv'],
\ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe'],
\ 'dsl': ['file.dsl'],
\ 'dtd': ['file.dtd'],
@@ -234,6 +234,7 @@ let s:filename_checks = {
\ 'kconfig': ['Kconfig', 'Kconfig.debug'],
\ 'kivy': ['file.kv'],
\ 'kix': ['file.kix'],
+ \ 'kotlin': ['file.kt', 'file.ktm', 'file.kts'],
\ 'kscript': ['file.ks'],
\ 'kwt': ['file.k'],
\ 'lace': ['file.ace', 'file.ACE'],