- Is there any chance of adding "tab character" available in the editing textbox?
- Have "Tab" key insert spaces when writing a question or answer
Note that this question, while related, is not the same as the ones linked.
In many cases, when people put code into questions or answers, they copy/paste the code from their editor. If their editor is using tab characters, the formatting will be broken after the post is submitted. For example, if a code is indented using TAB characters, then one TAB character in the beginning of a line will be treated as one level of indent and align with the left edge of the code, effectively indenting equally to 4 spaces. However in the post editor it looks indented twice - the same as 8 spaces.
I often edit other people's posts to improve code formatting and I find this TAB issue being the biggest annoyance.
Most of the times (I think) on SO, we use 4 spaces to format/indent the code. I think it would be an easy thing to auto-expand TAB characters inside
<code> blocks by replacing them with 4 spaces when the post is submitted.