Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMR_DOCUMENTFEED #127

Closed
maboroshin opened this issue Aug 13, 2019 · 12 comments
Closed

IMR_DOCUMENTFEED #127

maboroshin opened this issue Aug 13, 2019 · 12 comments
Labels
✅enhancement ime upstream scintilla Changes depends on upstream Scintilla
Milestone

Comments

@maboroshin
Copy link
Contributor

maboroshin commented Aug 13, 2019

IMR_DOCUMENTFEED (I forgot the official name) is useful for Japanese IME (Maybe even in Chinese). However, it is mainly Japanese information. It is also mysterious because there is no official website. I tried to implement it myself last year. It ’s too difficult for me. I give up. I want you to implement it if possible.

This function distinguishes kanji with the same pronunciation. (As explanation. Actually more complicated)

The IME sends the following twice : msg:WM_IME_REQUEST/wParam:IMR_DOCUMENTFEED .
So catch it : if (wParam == IMR_DOCUMENTFEED) .

  • First time. IME sends: lParam:0 .
  • The application returns the size. sizeof(RECONVERTSTRING)+lengthOfString(byte, including the terminating zero).
  • The IME reserves a data area. The IME sends the pointer.
  • Pseudo code to imagine it: struct { RECONVERTSTRING reconv; TCHAR compstr[n]; };
  • Detect the second time: if (lParam != 0)
  • The application returns the necessary data. Details below.

Reference site (Japanese) : website 1, website 2, website 3

A single paragraph is sufficient for the length of the string. e.g. SetReconvertStruct() get 50 or 200 characters.

Sample code (Japanese) .

@zufuliu zufuliu added ✅enhancement upstream scintilla Changes depends on upstream Scintilla labels Aug 13, 2019
@zufuliu
Copy link
Owner

zufuliu commented Aug 13, 2019

The name is correct, official document at https://docs.microsoft.com/en-us/windows/win32/intl/imr-documentfeed

@maboroshin
Copy link
Contributor Author

maboroshin commented Aug 14, 2019

Thank you!

This function is commonly called “Before and after feedback”( 前後フィードバック or 前後参照 ) in Japanese. This is probably not a search hit in English.
There seems to be no official information on the details of the structure.

@maboroshin
Copy link
Contributor Author

maboroshin commented Aug 14, 2019

This function should be turned on/off from Notepad2 (via Scintilla's variable).
Beacuse, It is written about the bug of IME in 2009. (JP) (But 10 years ago)
crash IME : In case IME's dictionary file is broken with IME2002/2003. (JP)

@zufuliu
Copy link
Owner

zufuliu commented Sep 4, 2019

I filled a feature request at https://sourceforge.net/p/scintilla/feature-requests/1310/.
It would helpful if there are steps to let IME makes the request.

@maboroshin

This comment was marked as outdated.

@maboroshin

This comment was marked as outdated.

@zufuliu
Copy link
Owner

zufuliu commented Jan 30, 2020

updated feature request at https://sourceforge.net/p/scintilla/feature-requests/1310/.
Thanks for the tests.

@maboroshin
Copy link
Contributor Author

Thank you.

By the way, IME cancellation. According to f75470d, Scintilla will be changed by moving AddWString in the code. Should it be as follows?

if (lParam & GCS_RESULTSTR) {
 AddWString(imc.GetCompositionString(GCS_RESULTSTR), CharacterSource::imeResult);
 initialCompose = true;

If this is adopted in Scintilla, the behavior of IME will be no different from common software. All that remains is DOCUMENTFEED only. Please upstream this AddWString location

@zufuliu
Copy link
Owner

zufuliu commented May 6, 2023

This is now implemented (see https://sourceforge.net/p/scintilla/feature-requests/1310/), please test latest builds (e.g. from https://github.com/zufuliu/notepad2/actions/runs/4901319426).

@maboroshin
Copy link
Contributor Author

maboroshin commented May 6, 2023

Nice news! I think it is working. The previously proposed test case did not work. Sorry.

Test Procedure: Notepad2 from 4901319426 above was used. And Notepad3 is scintilla not updated.
I used Win10 which I don't use much. And This PC is a clean install once every few months.

  1. 夏は暑い NATU HA [ENTER] ATUI [ESC]
  2. 本は厚い HON HA [ENTER] ATUI [ESC] (And Typo "AYU HA")
  3. お湯は熱い OYU HA [ENTER] ATUI [ESC]

n2atu

I tried with Notepad2. Text 1 and 3 were correct. Text 2 was an error. This (熱い) is a candidate for Text 3. Thus, this feature (IMR_DOCUMENTFEED) may not be powerful.

Only Text 3 is correct when trying with Notepad3. All are "熱い".

I tried again with Notepad2. Text 1 and 3 were correct. Thus, this feature is weak but working.

@maboroshin
Copy link
Contributor Author

maboroshin commented May 6, 2023

https://www.youtube.com/watch?v=8-qaEHzaW24
johnsonj says in this video. Works only if text is on the left side : I'm typing a sentence that continues, Instead of injecting it into the previous text. It is the same behavior in other programs. (Chrome, Firefox, EmEditor, Sakura editor)

@maboroshin
Copy link
Contributor Author

maboroshin commented May 7, 2023

This test is recommended. In 2023 - 2024, this test case works well for Windows 10.

Another test case from a previous text (#127 (comment)) works well : Refference site(jp): 2

  1. SAITA 最多 : (My case, Win10 preinstalled Microsoft IME) (Standalone case, Initial values or dictionary learning appear)
  2. HANA GA SAITA 花が咲いた (Ideal case)
  3. NUNO WO SAITA 布を裂いた (Ideal case)
  4. JIKAN WO SAITA 時間を割いた (Ideal case)

Sample text:

花が
布を
時間を

In my tests, 1 and 3 were correct in Notepad2 above. All failed in Notepad3, Returned 0 (最多) in all cases.

(This case can use "SAKU" instead of "SAITA". SAITA is past tense. It is natural Japanese. But I don't know if the candidate is appropriate.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅enhancement ime upstream scintilla Changes depends on upstream Scintilla
Projects
None yet
Development

No branches or pull requests

2 participants