glacambre / firenvim

Embed Neovim in Chrome, Firefox & others.
GNU General Public License v3.0
4.68k stars 144 forks source link

Firenvim inserts newlines when using japanese input method on Mac #1467

Open glacambre opened 1 year ago

glacambre commented 1 year ago
    On mac, when I press enter to accept some word, it also adds a new line before the selected word

https://user-images.githubusercontent.com/6012864/200115185-2c074c87-1eca-4341-a85b-864fcfee70c2.mov

Originally posted by @alanoliveira in https://github.com/glacambre/firenvim/issues/1431#issuecomment-1304488201

j-o-lantern0422 commented 1 year ago

The same thing is happening in my environment.

glacambre commented 1 year ago

@j-o-lantern0422 Could you save the following page on your disk, disable firenvim, open the page in your browser, type a single word using your japanese input method and then copy the logs that are appended to the page here?

<!doctype html>
<html lang="en">
        <head>
                <meta charset="utf-8">
                <meta name="viewport" content="">
                <title></title>
        </head>
        <body>
                <textarea id="textarea"></textarea>
                <pre id="log"></pre>
                <script>
                        const pre = document.getElementById("log");
                        function log(e) {
                                pre.innerText += `bubbles: ${e["bubbles"]}, cancelBubble: ${e["cancelBubble"]}, cancelable: ${e["cancelable"]}, composed: ${e["composed"]}, data: ${e["data"]}, dataTransfer: ${e["dataTransfer"]}, defaultPrevented: ${e["defaultPrevented"]}, detail: ${e["detail"]}, eventPhase: ${e["eventPhase"]}, inputType: ${e["inputType"]}, isComposing: ${e["isComposing"]}, isTrusted: ${e["isTrusted"]}, layerX: ${e["layerX"]}, layerY: ${e["layerY"]}, rangeOffset: ${e["rangeOffset"]}, rangeParent: ${e["rangeParent"]}, returnValue: ${e["returnValue"]}, timeStamp: ${e["timeStamp"]}, type: ${e["type"]}, which: ${e["which"]}\n`;
                        }
                        ["beforeinput", "input", "keydown", "keyup", "compositionstart", "compositionend"].forEach(ev => {
                                document.getElementById("textarea").addEventListener(ev, e => {
                                        log(e);
                                });
                        })
                </script>
        </body>
</html>

Also, can you tell me what OS and browser you are using?

shunsuke6 commented 1 year ago

@glacambre in the same way.

I think it is a problem with Japanese input, not environment.

In Japanese input, press the space bar to perform a conversion. Press the Enter key to confirm the conversion.

It often happens the same way because this input behavior is unthinkable in the English-speaking world.

Since there seems to be no progress, I will post the logs I ran.

j-o-lantern0422 commented 6 months ago

@glacambre Sorry it took me so long to reply. I tried to retrieve the log.

As shunsuke6 said, it is a common problem with Japanese input rather than the environment. For example, I had a problem in the past that I could not input Japanese inline in a terminal emulator. example: https://github.com/wez/wezterm/issues/3411

It may or may not occur depending on the IME, but it did occur in GoogleIME.

I'll note the environment as well.

OS: macOS 14.3.1 Browser: Google Chrome and Vivaldi

japanese_input.log