marijnh/CodeMirror2 — pull request #347 by bfrohs (2012-02-02 21:29:52+00:00)
Title: Enable styles for cursor when Overwrite (insert) is enabled

Currently, it is impossible for the end user to tell if *overwrite* is enabled (by pressing `Insert` key). With this patch, the class `CodeMirror-overwrite` is applied to the cursor when *overwrite* is enabled, and removed when *overwrite* is disabled. The style applied is a semi-transparent red box over the following letter (that will be overwritten if a character is entered) with the cursor (1px black line) still visible in the correct spot (to avoid confusion of what character will be removed when pressing `Backspace`.

The color of the overwrite cursor can be easily changed either in the original `codemirror.css` or any individual mode with the following CSS:

`.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}`

Even if you prefer not to have the styles applied, I'd recommend at least applying the changes in `codemirror.js` so the class is assigned for anyone that does want to apply the styles in a mode.