ANisus
ANisus

Reputation: 77975

Make End key move to line wrap when using lineWrapping in CodeMirror

In browser textarea editors (as well as in other editors, Sublime, Notepad++, etc), pressing the End key would move the caret to the end of the current line where it is wrapped. In case the caret is already there, it will instead be taken to the end of the paragraph.

However, when using:

lineWrapping: true

in CodeMirror, the End key will take the caret directly to the end of the paragraph instead of the end of the current line.

Is there any easy way to change this behavior?

Upvotes: 2

Views: 399

Answers (1)

Marijn
Marijn

Reputation: 8929

You can set CodeMirror.keymap.default.End = "goLineRight", which will do the first thing you describe (move to the right of the wrapped part of the line), but that does not currently go all the way to the end of the line if you press it twice.

(Similarly, CodeMirror.keymap.default.Home = "goLineLeft" for the Home key.)

Upvotes: 4

Related Questions