zufuliu / notepad4

Notepad4 (Notepad2⨯2, Notepad2++) is a light-weight Scintilla based text editor for Windows with syntax highlighting, code folding, auto-completion and API list for many programming languages and documents, bundled with file browser plugin matepath.
Other
3.34k stars 212 forks source link

IDM_VIEW_AUTOC_ENGLISH_ONLY seems not work properly #73

Closed bluenlive closed 6 years ago

bluenlive commented 6 years ago

With Korean IME(maybe with other IMEs), IDM_VIEW_AUTOC_ENGLISH_ONLY seems not work properly. Even when IDM_VIEW_AUTOC_ENGLISH_ONLY is false, we cannot use "auto completion" feature with Korean.

Maybe following lines in notepad.c causes it:

        case SCN_CHARADDED:
            if (scn->ch > 0x7F) {
                return 0;
            }

Could you check it?

zufuliu commented 6 years ago

Notapad2 (currently) only support auto-completion for _a-zA-Z0-9 and some punctuation, a later version may add support for extended Latin characters, see https://github.com/zufuliu/notepad2/issues/36.

The new option "Auto Complete Words Only in English IME Mode" is that, modern IME in native mode (Chinese, Japanese, Korean, etc.) may let user select English words, when this option is enabled, the selected word will NOT trigger auto-completion.

I think directly type Korean text is quicker than auto-completion. Another reason is that CJK text doesn't has space between characters, auto-completion with a full sentence (or paragraph in ANSI encoding mode, as punctuation is treated as word in Scintilla, this is still not fixed, see https://sourceforge.net/p/scintilla/feature-requests/1226/).

bluenlive commented 6 years ago

Okay. I understand it. I'll close this issue.

Thank you, always.

zufuliu commented 5 years ago

Hi @bluenlive, auto completion for Korean is possible (by Alt + / or Edit -> Insert -> Complete Word) since commit c4f533e7eac430dcc81378c48bf122dac6912030.

Auto completion on typing can be implemented (as an option?) by change SCN_CHARADDED: https://github.com/zufuliu/notepad2/blob/master/src/Notepad2.c#L4880

if (!autoCompletionConfig.bCompleteWord
    // ignore IME input
    || (scn->modifiers && (ch >= 0x80 || autoCompletionConfig.bEnglistIMEModeOnly))
    || !IsAutoCompletionWordCharacter(ch)
) {
    return 0;
}

and IsAutoCompletionWordCharacter(): https://github.com/zufuliu/notepad2/blob/master/scintilla/src/Document.h#L549

bool IsAutoCompletionWordCharacter(unsigned int ch) const noexcept {
    return WordCharacterClass(ch) == CharClassify::ccWord;
}