5

Possible Duplicate:
The Editor - Possible Improvements

When copying and pasting code, I'm sure many have run into a problem dealing with indentation. When trying to indent a line (or lines of code), the asker or editor must manually type in or delete the spaces in order to have correct indentation.

In my opinion, it would be much more useful (especially on the code-focused stackexchange sites) to have the tab key work similar to how it works in a modern IDE. That is to say, when the typer presses the TAB key, the cursor will indent a certain number of spaces.

More advanced functionality would also include highlighting blocks of text for group indentation or de-indentation after the press of the TAB key.

Is this feature request feasible, or even possible with modern browsers? If it is, can it be incorporated into the stackexchange sites?

6
  • It's definitely possible, if that's all you needed to know. Commented May 31, 2011 at 23:40
  • What would it take to incorporate it into the stackexchange sites? I guess I'm actually requesting this feature.
    – John
    Commented May 31, 2011 at 23:44
  • What keystroke would exit the textarea?
    – Gabe
    Commented Jun 1, 2011 at 2:28
  • You could capture control+tab instead, and leave tab to exit the box
    – Bryan Agee
    Commented Jun 1, 2011 at 7:58
  • @Bryan But ctrl + tab is captured by the browser to switch between browser tabs
    – Yi Jiang
    Commented Jun 1, 2011 at 9:18
  • Is it necessary for the user to be able to exit the textarea via a keyboard press? Perhaps you could capture the tab within the textarea, then have the user hit escape if they wanted to release it to its normal function.
    – John
    Commented Jun 1, 2011 at 17:04

1 Answer 1

4

I don't think this is a good idea. tab is specifically used to switch between fields, and may users rely on that accessibility feature. We should not be overriding standard accessibility features like that. See Improvements to editor for formatting source code for a large list of reasons why.

If you need to enter code with multiple levels of indentation, create it in an external editor and paste it in.

2
  • IMO that is a very poor answer. Instead of focusing on the one user who doesn't have a working mouse, we should instead focus on the mass horde of people who are frustrated by the lack of tab functionality for indentation. If it is possible to change the tab key to handle indentation changes, then it surely is also possible to change "shift alt tab" to be the expected tab character, for the one user who does not have a mouse to use. Commented Aug 23, 2013 at 17:40
  • I use "shift alt tab" as a suggested alternative for tab. Perhaps it would be better to use "alt tab" as tab when in the code editor, and "shift alt tab" as "untab" or the usually assigned "shift tab". Commented Aug 23, 2013 at 17:42

Not the answer you're looking for? Browse other questions tagged .