glacambre / firenvim

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

Empty lines are sometimes doubled when editing text box in Firefox #1608

Open aclindsa opened 5 months ago

aclindsa commented 5 months ago

What I tried to do

Edit a text field at https://jupyter.org/try-jupyter/notebooks/?path=notebooks/Intro.ipynb with firenvim in Firefox, and have blank lines be preserved across entering/exiting the editing session.

What happened

When beginning to edit a text field with firenvim in Firefox, single blank lines in the browser's native text box becomes two blank lines in firenvim in some situations. For example, opening this:

2024-05-03-105625_397x233_scrot

becomes this in firenvim:

2024-05-03-105709_7720x2160_scrot

And, predictably, if I write the results of that editing session without first deleting the extra two lines, I end up with extra newlines back in the firefox text box:

2024-05-03-110100_371x307_scrot

Additional observations

Note that it is only empty lines which are doubled - two adjacent non-empty lines do not have an extra newline inserted between them (honestly, this confuses me more than if every newline were doubled!).

Also, this isn't universally the case - some text boxes work fine, but other times I see the blank line-doubling behavior. You can visit https://jupyter.org/try-jupyter/notebooks/?path=notebooks/Intro.ipynb to test a problematic case - edit the text field with the first line of "from matplotlib import pyplot as plt" in Firefox.

I am able to use firenvim in Chromium and do not observe the same behavior as I do in Firefox. I also noticed while testing this that in Firefox, firenvim has the filetype set to text, while chromium has it set to python... I don't know if that's a clue or just some other difference.