question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CodeMirror>5.16 & Safari 10: Strange behavior with spaces

See original GitHub issue

After upgrading CodeMirror to 5.21 (from 5.8) in jupyter/notebook, users started encountering a strange bug on Safari 10. I did some investigating and found that this bug starting affecting notebook when upgrading from CodeMirror 5.16 to 5.17.

Demo:

jupytercode_spacing

One of the users determined that code cells (Python syntax, etc.) exhibit this behavior:

  • Immediately after any delimiter
    • e.g. =, ,, ., (, ), [, ], {, }, ", ', etc.
  • Not within closed delimiters
  • Not within compound statement if closed by :
    • e.g. it will occur here if x =={cursor}, but not hereif x =={cursor}:

Markdown cells (Markdown syntax) exhibit this behavior when typing a single space:

  • Unless cursor is at start of a new line
  • Unless cursor is placed immediately after closed markup delimiter (e.g. *text*{cursor})
  • Unless within markup delimiters (e.g. *text{cursor}*)

Here is a list commits included in 5.17: https://github.com/codemirror/CodeMirror/commits/master?after=Y3Vyc29yOjiTKo4zLKAvc9OV%2BJnP36dpIuEyKzIwOQ%3D%3D

I have a feeling that this commit might be the culprit although I haven’t been able to resolve this by simply reversing the changes in this commit: https://github.com/codemirror/CodeMirror/commit/2c913e5d2914fdc64df80031544a384940006feb

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
minrkcommented, Jan 12, 2017

5.22.1 doesn’t appear to exist, but 5.22.2 is on bower now, the first release produced by the automated bower packaging.

0reactions
gnestorcommented, Jan 21, 2017

I was able to isolate this bug to this commit: https://github.com/codemirror/CodeMirror/commit/e60f4b7dd88b71e227f79200932c028ca047d78e

@marijnh Any idea why this commit would cause the insertion of single spaces to not move the cursor (and then the cursor jumps to the proper position on a subsequent space)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spacing in text cells on Safari 10 #1967 - jupyter/notebook
Strange space formatting occurs: Unless cursor is at start of a new line; Unless cursor is placed immediately after closed markup delimiter ( ......
Read more >
Strange behavior with spaces and symbols in codemirror
I'm working with CodeMirror in React and everything is fine, but for some reason when I press a symbol, spaces or tab the...
Read more >
Safari Technology Preview Release Notes - Apple Developer
It marks both the free space and gaps between flex items to reveal how they affect the result. If you see bugs or...
Read more >
Dot being added when pressing space repeatedly - CodeMirror
Go to the editor at https://codemirror.net/6/ place cursor directly after a character. ... Safari + Chrome both exhibit the same behaviour.
Read more >
pre-wrap line sometimes puts whitespace at the start of a ...
Issue 246127: Wrapping a white-space: pre-wrap line sometimes puts whitespace ... behavior where the space ends up after the wrap, causing the odd...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found