twinejs icon indicating copy to clipboard operation
twinejs copied to clipboard

2.4: CodeMirror crashes if a format uses cm.doc.replaceSelection() where the replacement contains a newline

Open webbedspace opened this issue 3 years ago • 1 comments
trafficstars

This is used by Harlowe's toolbar for block-level markup, like headers. Since they must start on a new line, the toolbar buttons runs cm.doc.replaceSelection("\n#" + wrapped, "around"); (paraphrased) where "wrapped" is whatever text was highlighted at the time.

Notably, this does NOT crash 2.3!

Some visual aides: image Fig.1. Before clicking. image Fig.2. The replacement is shown, but soon afterward... image Fig.3. The error occurs.

Twine version number

2.4.0-beta3

Does this problem occur with the web version of Twine or the desktop app?

Web

What operating system does this problem occur on?

Windows

If this problem is occurring with the web version of Twine, what browser does it occur on?

Firefox

Presubmission checklist

  • [ ] I am interested in working on code that would fix this bug. (This is not required to submit a bug report.)
  • [X] I have done a search and believe that an issue does not already exist for this bug in the GitHub repository.
  • [X] I have read and agree to abide by this project's Code of Conduct.

webbedspace avatar Apr 15 '22 16:04 webbedspace

This reads like an issue with CM but I need to try to repro this on my side to understand better. If it's with CM, you might have to work around it. I can try upgrading CM (2.4 is on 5.65.1, there is 5.65.3) but the changelog doesn't mention this issue.

klembot avatar Apr 23 '22 15:04 klembot