Be robust against Firefox sometimes returning a zero-width rect #75
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This sometimes occurs in Firefox when a codemirror view is invisible initially. The rect does have a usable height, but the width is zero. This causes a set of Infinity and NaN values later in the flow.
Be more robust against that: default it to a sensible value.
I manually verified this fixes https://github.com/codemirror/dev/issues/1642. Since this codeflow is only hit in a case where everything errors out later anyway I'm quite confident about this fix.
How about just
charWidth = rect && rect.width ? rect.width / 27 : 7, for simplicity?I've merged the simpler patch.
Sorry for not responding right away! Thanks so much!
Pull request closed