Don't don't re-focus a focused textarea
It causes side effects on iOS On old IEs, don't do this check, since it sometimes raises weird exceptions, and re-focusing is harmless there.
Rewrite formatting.js to use available mode tokenizer
Remove a bunch of regexp kludges that never really worked. Will need to be tested more rigorously (I only tried the existing demo).
Make sure horizontal scroll events coming from the scroller are inter…
…preted precisely Even when they move by only one pixel. This prevents the gutter from coming to rest in a one-pixel-off position.
Add extendSelection and setExtending, clean up selection model
The 'inverted' hack which hailed from the ancient times when selection was handled by the hidden textarea, has been replaced with a saner explicit anchor and head. setSelection now directly sets the anchor and head, rather than always creating a forward selection.
[vim] Ctrl-[ leaves insert mode, same as <Esc>
As a die-hard vim addict, long ago, I retrained myself to type Ctrl-[ to
leave insert mode. This sends the same control sequence as escape in
many other places, actually, and this patch brings this functionality to
CodeMirror.
From vim's :help ctrl-[
*i_CTRL-[* *i_<Esc>*
<Esc> or CTRL-[
End insert or Replace mode, go back to Normal mode.
Finish abbreviation.
Note: If your <Esc> key is hard to hit on your keyboard, train
yourself to use CTRL-[.
Typing CTRL-[ is particularly easy when caps-lock is remapped
to being another CTRL key, since now neither hand needs to move away
form the homerow, and both little fingers just slide a little, the left
little finger slides to the right to where caps lock used to be, and the
right little finger slides a little bit up to the '[' keyPrevent gutter flickering on horizontal scroll in IE
Apparently, IE does a redraw as soon as you assign to scrollTop/scrollLeft. Closes #992
Make htmlmixed properly check for "tag" style
This allows the xml mode to return a style with space separated classes and still work. I didn't use /\btag\b/ since that can match "tag-foo".
Move the previous mode property before adding mode extensions
This stores the previous value for a mode property if an extension overwrites it with a new value. The old value is stored in a property prefixed with an underscore (e.g. "_token"). This allows extensions to piggyback the old value by still being able to access it.
fix extra indentation in array initialization
array initialization (one entry per line) results in extra indentation from second element onwards:
ex:-
const string[] fields = {
 "one",
  "two",
  "three"
};Add addKeyMap and removeKeyMap methods
Useful for add-ons that need to register keys.
See discussion in #984