Broken/unusable editor after foldAll command on specific file #7088

Open
opened 2024-02-29 13:47:10 +01:00 by marijnh · 0 comments
marijnh commented 2024-02-29 13:47:10 +01:00 (Migrated from gitlab.com)

Showstopper bug encountered...
The attached code when used in a CodeMirror instance with the following config, and after doing the "foldAll" command give the error and continues giving the error on every attempt to scroll, making the editor completely unusable.

Error:
TypeError: Cannot read properties of undefined (reading 'line') at cmp (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:986:42) at compareCollapsedMarkers (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:1502:17) at collapsedSpanAtSide (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:1514:22) at collapsedSpanAtEnd (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:1520:46) at visualLineContinued (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:1573:21) at new LineView (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:2004:17) at updateExternalMeasurement (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:2369:46) at prepareMeasureForLine (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:2407:16) at cursorCoords (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:2662:47) at TextareaInput.prepareSelection (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:9461:21)]]

CodeMirror config:
let config = { mode: mode, lineWiseCopyCut: false, theme: "neat", autoRefresh: true, matchBrackets: true, lineNumbers: true, scrollbarStyle: "overlay", tabSize: 2, keyMap: "sublime", autoCloseBrackets: true, foldGutter: true, styleActiveLine: true, search: { bottom:true}, gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], extraKeys: {"Ctrl-Space": "autocomplete", "Alt-F": "findPersistent"}, };

File that exibits this behavior, with cursor position anywhere is attached.
foldAll_bug_example.zip

Showstopper bug encountered... The attached code when used in a CodeMirror instance with the following config, and after doing the "foldAll" command give the error and continues giving the error on every attempt to scroll, making the editor completely unusable. Error: `TypeError: Cannot read properties of undefined (reading 'line') at cmp (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:986:42) at compareCollapsedMarkers (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:1502:17) at collapsedSpanAtSide (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:1514:22) at collapsedSpanAtEnd (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:1520:46) at visualLineContinued (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:1573:21) at new LineView (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:2004:17) at updateExternalMeasurement (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:2369:46) at prepareMeasureForLine (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:2407:16) at cursorCoords (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:2662:47) at TextareaInput.prepareSelection (http://localhost:6060/modules/codemirror_module.min.js?hash=1.6.2:9461:21)]]` CodeMirror config: ` let config = { mode: mode, lineWiseCopyCut: false, theme: "neat", autoRefresh: true, matchBrackets: true, lineNumbers: true, scrollbarStyle: "overlay", tabSize: 2, keyMap: "sublime", autoCloseBrackets: true, foldGutter: true, styleActiveLine: true, search: { bottom:true}, gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], extraKeys: {"Ctrl-Space": "autocomplete", "Alt-F": "findPersistent"}, };` File that exibits this behavior, with cursor position anywhere is attached. [foldAll_bug_example.zip](https://github.com/codemirror/codemirror5/files/14448093/foldAll_bug_example.zip)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/codemirror5#7088
No description provided.