mozilla/friendlycode — pull request #173 by Pomax (2013-01-18 20:31:05+00:00)
Title: added tab-as-spaces replacement for the codemirror textarea

This fixes tabs at 2 spaces, and replaces tabulation codes inserted by the tab key with two spaces, as well. The replacement code is an undocumented use of replaceSelection/2 in CodeMirror, but it was suggested by Marijn in https://groups.google.com/forum/?fromgroups=#!topic/codemirror/E9ti769jBng so thats pretty much the highest authority we can rely on. It replaces the insertion from "tab" with the two spaces, then cancels the "text select" that the replaceSelection call usually effects.