Take the 2-minute tour ×
User Experience Stack Exchange is a question and answer site for user experience researchers and experts. It's 100% free, no registration required.

What I mean is the following standard behavior: If you select a text and then press any key, the text will be deleted and replaced with the character that you just entered.

The only notable exception is pressing Tab or Shift+Tab, which will indent / dedent the block of text in most modern editors.

I honestly don't understand why it was decided that deleting the text is the best behavior in this case.

The real question however is: how bad it would be to abandon this ancient convention? would the users ever forgive me for this sacrilege? Because there's so much you can do with a selected block of text if you don't insist on destroying it... For example, pressing " or { could surround it with quotes / curly braces. Typing <blockquote> could automatically insert a matching closing tag at the end of the selected text. Type /* to comment out the selected text in an atomic operation (you know in VS if you just type /* it reparses the entire file and marks everything as a comment. When you insert */ it reparses and highlights everything once again. With Intellisense on this becomes a very slow process...). And so on.

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

Simple text editors behave as you have described where selecting text and then typing something overwrites the text with whatever you have typed. This is partly historical, partly due to implementation simplicity, and partly a UX issue. I'll focus on the UX issues.

If you select some text (called text blocking) in a paragraph - lets say it's "This is some text" - and start typing the word "hello", what makes the most sense? The option you have are:

  1. Prepend the new text: "helloThis is some text"
  2. Append the new text: "This is some texthello"
  3. Replace the selected text: "hello"
  4. Do nothing

There is no key visual indication between options 1 and 2, and so either of them would be poor choices. Option 4 is also a poor choice as it blocks input and is likely to cause confusion. However, option 3, replacing the selected text, is a simple interaction that is easy for most users to predict and understand.

Additionally, it is part of the standard of how text elements should be handled in browsers, so it's unlikely to change any time soon for general use.


Now, not all text editors work that way. Text editors designed for programming are usually more intelligent. For example if I select some text in the Sublime text editor and press " it will simply surround the text with " characters. Similarly, if I selected ( the text would then be surrounded by parentheses.

Most advanced text editors either come like this out of the box, or have plugins to change the behaviour. Vim and Emacs are additional examples, but I'm sure there are many more.

share|improve this answer
    
Lyx is another example. If I highlight a equation and type /frac then the equation that was there before, is now on the top line of the fraction –  Oxinabox Feb 2 at 5:15
add comment

In addition to the very excellent points made by @JohnGB, there's another important factor:

It's not very destructive

Even as far back as the original Macintosh in 1984*, if you didn't want the text to be deleted, a simple undo (⌘-Z on the original Mac IIRC).

Destructive actions only need a safety barrier if they're not easily reversed.

* I can't recall if the Xerox original had undo or not.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.