1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 22:42:48 +03:00

windows: fix stuck IME composition when switching input methods

refs: https://github.com/wez/wezterm/issues/1922
This commit is contained in:
Wez Furlong 2022-04-26 07:29:48 -07:00
parent c5116656ef
commit 8005c9df98
2 changed files with 17 additions and 0 deletions

View File

@ -39,6 +39,7 @@ As features stabilize some brief notes about them will accumulate here.
* `nf-mdi-contacts` nerdfont symbol treated as zero-width [#1864](https://github.com/wez/wezterm/issues/1864)
* X11/Wayland: CTRL-i, CTRL-j, CTRL-m misinterpreted as CTRL-Tab, CTRL-Enter, CTRL-Return [#1851](https://github.com/wez/wezterm/issues/1851)
* Scrollbar stopped working after a lot of output scrolled outside of the scrollback limit. Thanks to [@davidrios](https://github.com/davidrios)! [#1866](https://github.com/wez/wezterm/pull/1866)
* Windows: uncommitted IME composition could get stuck when switching input methods. [#1922](https://github.com/wez/wezterm/issues/1922)
### 20220408-101518-b908e2dd

View File

@ -1719,6 +1719,21 @@ impl Drop for ImmContext {
}
}
unsafe fn ime_end_composition(
hwnd: HWND,
_msg: UINT,
_wparam: WPARAM,
_lparam: LPARAM,
) -> Option<LRESULT> {
// IME was cancelled
let inner = rc_from_hwnd(hwnd)?;
let mut inner = inner.borrow_mut();
inner
.events
.dispatch(WindowEvent::AdviseDeadKeyStatus(DeadKeyStatus::None));
Some(1)
}
unsafe fn ime_composition(
hwnd: HWND,
_msg: UINT,
@ -2438,6 +2453,7 @@ unsafe fn do_wnd_proc(hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM) ->
}
WM_SETTINGCHANGE => apply_theme(hwnd),
WM_IME_COMPOSITION => ime_composition(hwnd, msg, wparam, lparam),
WM_IME_ENDCOMPOSITION => ime_end_composition(hwnd, msg, wparam, lparam),
WM_MOUSEMOVE => mouse_move(hwnd, msg, wparam, lparam),
WM_MOUSELEAVE => mouse_leave(hwnd, msg, wparam, lparam),
WM_MOUSEHWHEEL | WM_MOUSEWHEEL => mouse_wheel(hwnd, msg, wparam, lparam),