From 0797c71c72e84a9fccb5e5ed98706bd9dfa022af Mon Sep 17 00:00:00 2001 From: Yuto Tokunaga Date: Thu, 7 Sep 2017 10:48:46 +0900 Subject: [PATCH 1/3] input: toggle IME when mode changed --- src/neovim/input.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/neovim/input.ts b/src/neovim/input.ts index 0ce8f85..3018be4 100644 --- a/src/neovim/input.ts +++ b/src/neovim/input.ts @@ -230,6 +230,8 @@ export default class NeovimInput { this.element.addEventListener('blur', this.onBlur.bind(this)); this.element.addEventListener('focus', this.onFocus.bind(this)); this.store.on('cursor', this.updateElementPos.bind(this)); + this.store.on('mode', () => this.toggleIme( + ['insert', 'replace', 'cmdline'].some(mode => mode === this.store.mode))); this.focus(); } @@ -390,4 +392,13 @@ export default class NeovimInput { this.element.style.left = x + 'px'; this.element.style.top = y + 'px'; } + + toggleIme(enable: boolean) { + if (enable) { + this.element.type = 'text'; + } else { + // any of number, tel, email, url can be used + this.element.type = 'email'; + } + } } From 7fe35fb1be6a0a813bda0ab4588842c236fb66d7 Mon Sep 17 00:00:00 2001 From: Yuto Tokunaga Date: Thu, 7 Sep 2017 22:00:32 +0900 Subject: [PATCH 2/3] fix for linux --- src/neovim/input.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/neovim/input.ts b/src/neovim/input.ts index 3018be4..d4ef2b8 100644 --- a/src/neovim/input.ts +++ b/src/neovim/input.ts @@ -397,8 +397,10 @@ export default class NeovimInput { if (enable) { this.element.type = 'text'; } else { - // any of number, tel, email, url can be used - this.element.type = 'email'; + // any of 'number', 'tel', 'email', 'url' works for Windows 10 but + // don't works for Linux + // 'password' (little hackey) works for Linux + this.element.type = 'password'; } } } From 02c77c5da966531d6c43478f13977f90e21f65c2 Mon Sep 17 00:00:00 2001 From: Yuto Tokunaga Date: Thu, 7 Sep 2017 22:10:18 +0900 Subject: [PATCH 3/3] add comment --- src/neovim/input.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neovim/input.ts b/src/neovim/input.ts index d4ef2b8..1c12123 100644 --- a/src/neovim/input.ts +++ b/src/neovim/input.ts @@ -399,7 +399,7 @@ export default class NeovimInput { } else { // any of 'number', 'tel', 'email', 'url' works for Windows 10 but // don't works for Linux - // 'password' (little hackey) works for Linux + // 'password' (little hackey) works both for Windows 10 and Linux this.element.type = 'password'; } }