Menu

#2120 Win32 IME candidate window obscures text

Bug
closed-fixed
5
2019-10-24
2019-07-14
No

When using an IME on Windows and the caret is near the bottom of the screen, candidate windows may not fit below the caret so are flipped up in an effort to not obscure the composition text. However, the current code only provides a position for the candidate window and this often leaves the composition text obscured like this image:
Flipped Candidate

This can be fixed by setting an exclusion rectangle for the caret's line of text.

const Point pos = PointMainCaret();
const PRectangle rcClient = GetTextRectangle();
CANDIDATEFORM CandForm{};
CandForm.dwIndex = 0;
CandForm.dwStyle = CFS_EXCLUDE;
CandForm.ptCurrentPos.x = static_cast<int>(pos.x);
CandForm.ptCurrentPos.y = static_cast<int>(pos.y + vs.lineHeight);
// Exclude the area of the whole caret line
CandForm.rcArea.top = static_cast<int>(pos.y);
CandForm.rcArea.bottom = static_cast<int>(pos.y + vs.lineHeight);
CandForm.rcArea.left = static_cast<int>(rcClient.left);
CandForm.rcArea.right = static_cast<int>(rcClient.right);
::ImmSetCandidateWindow(imc.hIMC, &CandForm);

This results in the candidate appeaing higher with all of the composition text visible.
Candidate Excluded

This change was initially discussed for a feature [feature-requests:#1300] but is useful independently so should be applied before #1300.

This was observed and fixed on Windows 10 1903.

A patch is attached.

1 Attachments

Related

Bugs: #2135
Feature Requests: #1300

Discussion

  • johnsonj

    johnsonj - 2019-07-14

    I will try it.
    Somthing is hidden in lineHeight.

     

    Last edit: johnsonj 2019-07-14
  • Zufu Liu

    Zufu Liu - 2019-07-14

    I think this can be considered as one of the three changes in cand-pos-0714.diff.
    1. (By John) Move SetCandidateWindowPos() into if (initialCompose) fixed candidate window moving bug except for Google Japanese IME on Win7.
    2. (By Me) Update CandForm.ptCurrentPos.y fixed candidate window been placed below second line instead of current input text.
    3. (By Neil) Change CFS_CANDIDATEPOS to CFS_EXCLUDE, this bug.

    The three changes can be committed independently.

    MoveImeCarets() will need another two or three commits.

     
  • Zufu Liu

    Zufu Liu - 2019-07-14

    As commnetd on https://sourceforge.net/p/scintilla/feature-requests/1300/?page=3&limit=25#6e9d
    This change (CFS_CANDIDATEPOS to CFS_EXCLUDE) also fixed Google Chinese IME bug on Win7.

     
    • johnsonj

      johnsonj - 2019-07-14

      I second that too.

       
  • johnsonj

    johnsonj - 2019-07-17

    It works good.
    tested on windows ime and google ime under win7.

     
  • Neil Hodgson

    Neil Hodgson - 2019-07-18
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2019-07-18

    Fix committed as [b99264].

     

    Related

    Commit: [b99264]

  • Neil Hodgson

    Neil Hodgson - 2019-10-24
    • status: open-fixed --> closed-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2019-10-24

    Fix committed as [b99264].

     

    Related

    Commit: [b99264]


Log in to post a comment.