Make cursor control configurable #4921

Open
opened 2017-08-18 20:42:20 +02:00 by marijnh · 4 comments
marijnh commented 2017-08-18 20:42:20 +02:00 (Migrated from gitlab.com)

There are currently a lot of right-to-left bugs with CodeMirror that are caused by it exercising control over the cursor rather than allowing the browser to handle cursor control. (See https://github.com/codemirror/CodeMirror/issues/4878 and https://phabricator.wikimedia.org/T170001.) Although browsers also have RTL bugs related to cursor control, everyone I have talked to about this issue (including a professional RTL engineer) agreed that it is better to let the browser handle cursor movement. Whatever quirks the browser may have, people who write in RTL (or mixed RTL and LTR) are intimately familiar with those quirks and expect them. Replacing those quirks and bugs with our own quirks and bugs is counter-productive. The goal of making the behavior consistent across different browsers is a very small gain compared to the huge loss of people not being able to enter content in the way that they expect and having to deal with new RTL bugs.

I would like to ask that the cursor control feature be configurable, so that individual installations can turn the feature off if they see fit.

There are currently a lot of right-to-left bugs with CodeMirror that are caused by it exercising control over the cursor rather than allowing the browser to handle cursor control. (See https://github.com/codemirror/CodeMirror/issues/4878 and https://phabricator.wikimedia.org/T170001.) Although browsers also have RTL bugs related to cursor control, everyone I have talked to about this issue (including a professional RTL engineer) agreed that it is better to let the browser handle cursor movement. Whatever quirks the browser may have, people who write in RTL (or mixed RTL and LTR) are intimately familiar with those quirks and expect them. Replacing those quirks and bugs with our own quirks and bugs is counter-productive. The goal of making the behavior consistent across different browsers is a very small gain compared to the huge loss of people not being able to enter content in the way that they expect and having to deal with new RTL bugs. I would like to ask that the cursor control feature be configurable, so that individual installations can turn the feature off if they see fit.
marijnh commented 2017-08-18 21:33:07 +02:00 (Migrated from gitlab.com)

I would like to ask that the cursor control feature be configurable, so that individual installations can turn the feature off if they see fit.

Though I agree that this is a good idea (and the approach I'm taking in ProseMirror), that's not possible with CodeMirror's architecture, since the selection is entirely managed and drawn by the library, and thus the browser can't be much help here.

> I would like to ask that the cursor control feature be configurable, so that individual installations can turn the feature off if they see fit. Though I agree that this is a good idea (and the approach I'm taking in ProseMirror), that's not possible with CodeMirror's architecture, since the selection is entirely managed and drawn by the library, and thus the browser can't be much help here.
marijnh commented 2017-08-18 22:20:15 +02:00 (Migrated from gitlab.com)

@marijnh: Could you elaborate on that any? Would it not be possible to make all the dynamic features of CodeMirror optional and implement a "highlight-only" mode that does nothing but simple syntax highlighting?

`@marijnh`: Could you elaborate on that any? Would it not be possible to make all the dynamic features of CodeMirror optional and implement a "highlight-only" mode that does nothing but simple syntax highlighting?
marijnh commented 2017-08-18 23:25:57 +02:00 (Migrated from gitlab.com)

No, that definitely wouldn't be possible -- you can't highlight a textarea, so you'd be dealing with the full complexity of contenteditable. Also, a system that does only highlighting would be CodeMirror, it'd be something completely different.

No, that definitely wouldn't be possible -- you can't highlight a textarea, so you'd be dealing with the full complexity of contenteditable. Also, a system that does only highlighting would be CodeMirror, it'd be something completely different.
marijnh commented 2018-09-07 11:39:33 +02:00 (Migrated from gitlab.com)

This is one of many issues which are difficult to solve with the fundamental approach currently taken by CodeMirror.

We are working on a rewrite (CodeMirror 6) that will overhaul input handling and should address this issue, and we are currently raising money for this work: See the announcement for more information about the rewrite and a demo.

Note that CodeMirror 6 is by no means stable or usable in production, yet. It is highly unlikely that we pick up this issue for CodeMirror 5, though.

This is one of many issues which are difficult to solve with the fundamental approach currently taken by CodeMirror. We are working on a rewrite (CodeMirror 6) that will overhaul input handling and should address this issue, and we are currently raising money for this work: See [the announcement](https://codemirror.net/6/) for more information about the rewrite and a demo. Note that CodeMirror 6 is by no means stable or usable in production, yet. It is highly unlikely that we pick up this issue for CodeMirror 5, though.
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#4921
No description provided.