I want to implement tabs in text that’s selectable. The problem is, if I replace a tab with three non-breaking spaces (for example), then when the user selects the text, they can actually select into the middle of a tab.
@6tr6trauthorOct 21.2009 — #How is selecting a tab related to replacing it with 3 non-breaking spaces?
What do you actually mean by "tabs in text"?[/QUOTE]
I mean when there's text in a div and the user presses down with the mouse and drags it, it creates a selection (which you can see via window.getSelection() ). However, if you simply put a tab into a div (i.e. t), it won't show up, just like the same issues with spaces at the beginning of a line. So most people either use pre tags (which are very limited in terms of layout/formatting) or replace a tab with a number of non-breaking spaces.
the problem with replacing it with non-breaking spaces is that when a user selects text (by dragging the mouse, thus highlighting the text the cursor has gone over), it will select the non-breaking spaces individually. So their selection ends up in the middle of a tab.
NOTE: The short version: I mean the tab KEY, not a tab like in a browser, but the key on the keyboard that says "tab"