Two new experimental branches open for testing: mobile and direction

The first, ‘mobile’, tries to improve CodeMirror’s support for mobile
devices. It implements a second input model, using contentEditable
instead of the traditional hidden textarea, and uses that on mobile
devices. This should mean selection and input should be a lot less
broken. The branch is here:
https://github.com/codemirror/CodeMirror/tree/mobile

The second, ‘direction’, improves support for right-to-left and
bidirectional text. It adds methods setDirection and setLineDirection
(as well as a ‘direction’ option) that allow you to control the text
direction for the whole document or per line. It also improves cursor
behavior in right-to-left wrapped text. This is mostly the result of
Radek Piórkowski’s summer of code work. The branch is at

If no big issues are found, both of these will eventually be merged
into the master branch. But since both make big, invasive changes, I’m
only going to do that after they’ve seen some testing by people
interested in these features.

Best,
Marijn

1 Like

Interested by the mobile branch. We will give it a spin this week.
Thanks!

This is very good news! Please let me know how I can help with the bidirectional feature testing.

Get the direction branch:

git clone -b direction http://marijnhaverbeke.nl/git/codemirror

And open the demo/bidi.html file that comes with the repository in your browser.

Shortcut without git: https://rawgit.com/codemirror/CodeMirror/direction/demo/bidi.html

I really appreciate your work to support touch input!
Here’s a demo link for the mobile branch: https://rawgit.com/codemirror/CodeMirror/mobile/demo/search.html

I tested this on two devices:

On Mobile Safari, text selection works by holding and tapping “select”, and it works quite well! I only found one issue: Double-tapping a word should select it, but this does not work in CodeMirror.
In Google Chrome on a touch-enabled laptop, selecting text with touch does not work at all.

I believe I’ve fixed the double-tap (and triple-tap) issue in iOS.

For a touch-enabled desktop, you might need to enable the contenteditable input backend manually, since it is currently only the default for mobile browsers (I hope to start using it for modern desktop browsers as well in the future, but it needs more testing). Set the inputStyle option to "contenteditable" to enable it regardless of platform.

I can confirm double-tap-to-select works now.

This is great news. I hope this can be merged to master soon (I’m currently migrating a web application from Ace to CodeMirror).

It has been merged into master today. Mobile Firefox still needs a bunch of work, and there will undoubtedly be bugs found, but things are looking good.