firenvim icon indicating copy to clipboard operation
firenvim copied to clipboard

Keep pressing the 'j', 'k', 'l', or 'm' key in normal mode doesn't work as expected.

Open jiyeol-lee opened this issue 3 years ago • 7 comments

  • OS Version: Mac OS Monetary 12.3.1
  • Browser Version: 101.0.4951.64
  • Browser Addon Version: 0.2.12
  • Neovim Plugin Version: 0.6.1

What I tried to do

Keep pressing the 'j', 'k', 'l', or 'm' key in normal mode.

What happened

It only moves one time even if I kept pressing the key

jiyeol-lee avatar May 29 '22 23:05 jiyeol-lee

Could you try the solution provided here? https://github.com/glacambre/firenvim/issues/118#issuecomment-536214851

glacambre avatar May 30 '22 05:05 glacambre

Yes, I tried it but it's not working. The funny thing is it's working very fine on my terminal(alacritty) but it only works differently on web nvim

jiyeol-lee avatar May 30 '22 14:05 jiyeol-lee

Please save the following HTML document to your disk, open it in your browser, disable Firenvim, select the textarea and press j until it repeats itself. This will add multiple lines to the document - please copy them 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>

glacambre avatar May 30 '22 15:05 glacambre

I got the same issue.

@glacambre this is the output you requested:

bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 7536, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: j, dataTransfer: null, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: insertText, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 7544, type: beforeinput, which: 0
bubbles: true, cancelBubble: false, cancelable: false, composed: true, data: j, dataTransfer: null, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: insertText, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 7544, type: input, which: 0
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 7793, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 7821, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 7855, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 7889, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 7922, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 7955, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 7988, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 8021, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 8055, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 8088, type: keydown, which: 74
bubbles: true, cancelBubble: false, cancelable: true, composed: true, data: undefined, dataTransfer: undefined, defaultPrevented: false, detail: 0, eventPhase: 2, inputType: undefined, isComposing: false, isTrusted: true, layerX: 0, layerY: 0, rangeOffset: 1, rangeParent: null, returnValue: true, timeStamp: 8108, type: keyup, which: 74

dantonyuk avatar Jun 28 '22 14:06 dantonyuk

@dantonyuk Thanks. These keydown events are completely broken, their data field should be set to j, not undefined. Can you confirm that you're using Chrome on OSX?

glacambre avatar Jun 28 '22 20:06 glacambre

@dantonyuk Thanks. These keydown events are completely broken, their data field should be set to j, not undefined. Can you confirm that you're using Chrome on OSX?

Firefox 101.0.1 (64-bit) Mac OS Monterey 12.3.1

dantonyuk avatar Jun 28 '22 21:06 dantonyuk

Great, thanks. I think a simple fix might be to store the last keydown event's timestamp, data and which fields. If the new event's data is undefined, then we can check if the timestamp of the previous event was a reasonable amount of time ago, and if it is and the which attribute is exactly the same, re-use the previous event's data.

Unfortunately I can't publish new releases for now due to new requirements in Chrome's web store, so this issue is unlikely to be fixed any time soon. In any case, thanks a lot for providing all this information.

glacambre avatar Jun 29 '22 04:06 glacambre