Menu

#1300 Stop IME candidate window moving while typing and position it better

Committed
closed
5
2023-05-03
2019-06-26
Zufu Liu
No

This feature request has added issues over time. The original issue is stated here:

See the screenshort (Pinyin IME in Chrome), and some screenshorts on https://sourceforge.net/p/scintilla/bugs/2038/

At least Chinese with Pinyin IME is more like the candidate window not moved on typing, not been distracted by the moved window: the position for the best candidate item (most likely first one) is at a consistent position on typing, making pick the item easy; otherwise more time will be spent on the candidate window to watch the position changes.

There are 5 candidate window improvements discussed on this feature request along with some other IME issues.

1) Stop candidate window overlapping composition text and taskbar.
2) Position candidate window closer to composition text.
3) Stop candidate window moving while typing.
4) Align candidate window to target part of composition text.
5) Stop Google IME on Windows 7 moving while typing.

(1) was extracted into a bug [#2120].

1 Attachments

Related

Bugs: #2120
Bugs: #2135
Bugs: #2137
Bugs: #2391
Feature Requests: #1304
Feature Requests: #1488

Discussion

1 2 3 .. 5 > >> (Page 1 of 5)
  • johnsonj

    johnsonj - 2019-06-28

    scintilla does nothing to candidate window position.
    just informs Ime of character position being input.
    the position of candidate window is set by Ime with the above info.

     
  • Zufu Liu

    Zufu Liu - 2019-06-28

    No, it moved see the screenshot.
    On Windows, it was caused by the call SetCandidateWindowPos() in ScintillaWin::HandleCompositionInline().
    If the call is moved to WM_IME_STARTCOMPOSITION, it will stay at the starting position.

    case WM_IME_STARTCOMPOSITION:   // dbcs
        if (imeInteraction == imeInline) {
            SetCandidateWindowPos();
            return 0;
        } else {
            ImeStartComposition();
            return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
        }
    

    I think this happens on GTK too, where ScintillaWin::HandleCompositionInline() => ScintillaGTK::PreeditChangedInlineThis() and WM_IME_STARTCOMPOSITION => preedit-start.

    Se the change to scintilla/win32/ScintillaWin.cxx at https://github.com/zufuliu/notepad2/commit/442308f0e19bedeb0cc1bb5b3f56daa6038f6ceb#diff-3116791c8fff3a31032997bb45378493R1053
    Ignore the change to CandForm.ptCurrentPos.y = static_cast<LONG>(pos.y + vs.lineHeight);, the candidate window looks far from caret line by adding vs.lineHeight (I think 4px offset would enough) like in https://sourceforge.net/p/scintilla/bugs/2038/#860f

     
    • johnsonj

      johnsonj - 2019-06-28

      How about this code?

      CandForm.ptCurrentPos.y = static_cast<long>(KoreanIme() ? pos.y + vs.lineHeight : pos.y);</long>

       
    • johnsonj

      johnsonj - 2019-06-30

      I also like this approach too.
      I think it will not influence on korean since input position of korean never moves while in composition until ending composition.

       
      • Zufu Liu

        Zufu Liu - 2019-06-30

        Only call SetCandidateWindowPos() when composition ending like:

        } else if (lParam & GCS_RESULTSTR) {
            AddWString(imc.GetCompositionString(GCS_RESULTSTR), CharacterSource::imeResult);
            // call SetCandidateWindowPos() at here?
        }
        

        or call it in WM_IME_ENDCOMPOSITION.

         
        • Zufu Liu

          Zufu Liu - 2019-06-30

          What's the purpose to move candidate window when composition ending? from my experience, the candidate window will disappear when composition finished.

           
          • johnsonj

            johnsonj - 2019-06-30

            Please do not get me wrong.
            I mean you may be right.
            As you pointed, Moving SetCandidateWindowPos() from ScintillaWin::HandleCompositionInline() into WM_IME_STARTCOMPOSITION may give no impact on korean ime.

            Sorry it needs time to update my old developing environment.

             
            • Zufu Liu

              Zufu Liu - 2019-07-04

              After read somewhere, I got that some IME not send WM_IME_STARTCOMPOSITION, but WM_IME_COMPOSITION with GCS_COMPSTR on starting composition.
              So that SetCandidateWindowPos() can't be removed from HandleCompositionInline().

               
  • johnsonj

    johnsonj - 2019-06-28

    CandForm.ptCurrentPos.y = static_cast<long>(pos.y + vs.lineHeight);</long>

    pos.y + vs.lineHeight was temporarily made against a bug of windows native korean ime.
    Your patch will make korean user not see their editing line downside by vs.lineHeight*3/4

    In addition, this code still can not cope with the last editing line.

    I suggest you introduce ChineseIme() if you want enhance chinese ime.
    I hope more chinese and japanese would join in to enhance their ime.
    I started KoreanIme() not to give influence on other language users.

     

    Last edit: johnsonj 2019-06-28
  • johnsonj

    johnsonj - 2019-06-28

    Windowed ime is not my reference model.
    not moving box is window ime bug.

    case WM_IME_STARTCOMPOSITION: // dbcs
    if (imeInteraction == imeInline) {
    SetCandidateWindowPos();
    return 0;
    } else {

    it is a good point.
    but I would like to do this.

    case WM_IME_STARTCOMPOSITION:
    SetCandidateWindowPos();

    You can see the right behaviors of windowed ime.

     

    Last edit: johnsonj 2019-06-28
  • Zufu Liu

    Zufu Liu - 2019-06-28

    This has no effect for windowed ime. it's not moved, that why it been moved into imeInline block, without it, the candidate window is at it's default position (like window mode).

    case WM_IME_STARTCOMPOSITION:   // dbcs
        SetCandidateWindowPos();
        if (imeInteraction == imeInline) {
            return 0;
        } else {
            ImeStartComposition();
            return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
        }
    

    The change to CandForm.ptCurrentPos.y can be discussed further.
    The current discussion is adding a option (default enabled) to conditional call SetCandidateWindowPos() in HandleCompositionInline() like

        if (moveCandidateWindowOnTyping) {
            SetCandidateWindowPos();
        }
    

    The candidate window not moving is not a bug at least for Chinese IME, see the screenshots for IMEs on macOS (all in inline mode) at https://sourceforge.net/p/scintilla/bugs/2038/?page=1&limit=25#954d

     
    • johnsonj

      johnsonj - 2019-06-28

      Yes, I understand.
      The korean candidate box is not moving either.
      I am sorry I confused candidate box with editing box.
      Korean candidate box should be shown at down under editing box.

       
      • Zufu Liu

        Zufu Liu - 2019-06-28

        Can you give a screeenshot about Korean IME?
        I'm confused which is the editing box?

        See my screenshots above, for Chinese Pinyin IME,
        the composition window is the window that contains Pinyin letters and separators, in above screenshot, it's the window or area in Scintilla contains z'z'z'z'z'z'z'z'z'z'z'z'z'z'z'z'z'z'z;
        the candidate window is the window that has first item been highlighted with green color, and contains numbered items that can be picked from.

        From https://docs.microsoft.com/en-us/windows/desktop/DxTechArts/installing-and-using-input-method-editors
        the candidate window is near composition window/area for all IME, not one line below; except when doing Hanja conversion, which seems a bug like this https://sourceforge.net/p/scintilla/bugs/2038/?page=1&limit=25#5324

         
        • johnsonj

          johnsonj - 2019-06-29

          Korean windowed ime box always is positioned at upLeft corner.
          Up box is for editing.
          Down box is candidate box.
          The thin vertical caret at code blocks indicates the position being input.

           
          • Zufu Liu

            Zufu Liu - 2019-06-29

            So windowed Korean IME completely displayed outside application window, that's why you need hard-coded inline mode.

            How about inline mode Korean IME in Chrome and code blocks? Is the candidate box on third line like:

            1 xxxx <- caret in Scintilla at here
            2 + vs.lineHeight
            3 candidate box
            

            or

            1 xxxx <- caret in Scintilla at here
            2 + vs.lineHeight: the edit box here
            3 candidate box
            

            Is candidate box still in vertical mode, like that in windowed mode.

             
            • johnsonj

              johnsonj - 2019-06-29

              inline mode has no edit box.
              it inserts and deletes into documents tentatively.
              code blocks has no inline ime feature.

              Here is a screen shot on chrome.

               
              • Zufu Liu

                Zufu Liu - 2019-06-29

                OK, I forgotten that code blocks is written in wxWidgets.

                So that, the candidate box is immediately below edit box, no need vs.lineHeight (one line offset), It's should looks like (which is same as Chinese Pinyin IME):

                line 1 xxxx <- caret in Scintilla at here
                line 2 candidate box in vertical direction aligned to left.
                

                Can you test Notepad2, disable "Settings" => "Inline IME Options" => "Move Candidate Window On Typing", See if it the inline IME works as expected (like it in Chrome and other applications). Thanks.
                64-bit at https://ci.appveyor.com/project/zufuliu/notepad2/build/job/ptd3jfsxnglnw4bn/artifacts
                32-bit at https://ci.appveyor.com/project/zufuliu/notepad2/build/job/j1l9ijq5fwqgeuwd/artifacts

                Please also test Windows SciTE at https://www.scintilla.org/SciTEDownload.html
                On Windows, SciTE for Korean always use inline mode. The screenshot is what I got for Chinese Pinyin IME, which not works as expected.

                 
                • johnsonj

                  johnsonj - 2019-06-29

                  Chinese inline ime of scintilla is similiar with MS WORD.

                  https://youtu.be/ywE-K4qK94g

                   
                  • Zufu Liu

                    Zufu Liu - 2019-06-29

                    Thanks, sadly I can't see the video.

                     
                    • johnsonj

                      johnsonj - 2019-06-29

                      I can not see it either on firefox under windows xp.
                      I will try it under windows 7.

                      it looks like windows native notepad.

                       
                      • johnsonj

                        johnsonj - 2019-06-29

                        OK! firefox under window7.

                         
                • johnsonj

                  johnsonj - 2019-06-29

                  Is there some way to download your notepad2 without AppVeyor?

                   
1 2 3 .. 5 > >> (Page 1 of 5)

Log in to post a comment.

MongoDB Logo MongoDB