@@ -687,21 +687,24 @@ void UpdateCursorPos(Renderer *renderer, mpack_node_t cursor_goto) {
687
687
}
688
688
689
689
void UpdateImePos (Renderer* renderer) {
690
- HIMC hIMC = ImmGetContext (renderer->hwnd );
691
- COMPOSITIONFORM cf = { 0 };
692
-
693
- cf.dwStyle = CFS_POINT;
694
- cf.ptCurrentPos .x = renderer->cursor .col * renderer->font_width ;
695
- cf.ptCurrentPos .y = renderer->cursor .row * renderer->font_height ;
690
+ HIMC input_context = ImmGetContext (renderer->hwnd );
691
+ COMPOSITIONFORM composition_form {
692
+ .dwStyle = CFS_POINT,
693
+ .ptCurrentPos = {
694
+ .x = static_cast <LONG>(renderer->cursor .col * renderer->font_width ),
695
+ .y = static_cast <LONG>(renderer->cursor .row * renderer->font_height )
696
+ }
697
+ };
696
698
697
- if (ImmSetCompositionWindow (hIMC, &cf)) {
698
- LOGFONTW lf = { 0 };
699
- lf.lfHeight = static_cast <LONG>(renderer->font_height );
700
- wcscpy_s (lf.lfFaceName , LF_FACESIZE, renderer->font );
701
- ImmSetCompositionFontW (hIMC, &lf);
699
+ if (ImmSetCompositionWindow (input_context, &composition_form)) {
700
+ LOGFONTW font_attribs {
701
+ .lfHeight = static_cast <LONG>(renderer->font_height )
702
+ };
703
+ wcscpy_s (font_attribs.lfFaceName , LF_FACESIZE, renderer->font );
704
+ ImmSetCompositionFontW (input_context, &font_attribs);
702
705
}
703
706
704
- ImmReleaseContext (renderer->hwnd , hIMC );
707
+ ImmReleaseContext (renderer->hwnd , input_context );
705
708
}
706
709
707
710
void UpdateCursorMode (Renderer *renderer, mpack_node_t mode_change) {
0 commit comments