Search and replace: What's the proper shortcut?

那年仲夏 提交于 2020-07-04 13:26:06

问题


Very simple dilemma. A user needs to be able to do a search-and-replace in a large piece of text. Code to do this is a piece of cake. No problems there. Works like a charm! Don't break your head over that. That's solved! It's a non-issue...

No, problem is defining a good shortcut for this function. While I would prefer to use CTRL+R as shortcut for this functionality (and CTRL-F for finding text) I noticed that Microsoft is using CTRL-H as shortcut! (And F3 to find text, although CTRL+F mostly works too.)

So, what should be the preferred shortcut for this simple function? CTRL-R or CTRL-H

And second Q for additional points: Where does CTRL-H come from? What does the H mean? At least, the R stands for Replace but the H???

This relates to the GUI design of a Windows application. While it's a trivial matter, it's just good to be consistent with the generally accepted norm! While GUI's aren't always popular amongst programmers, keeping your GUI consistent with the norm is definitely programming-related!


回答1:


While I also think that Ctrl+R is the more "obvious" and "natural" choice for replace, I'd go for Ctrl+H because of consistency reasons. If users are used to replace text by using Ctrl+H (e.g. because they use MS Word) then they'll be happy if it works in your app as well... however, if it won't work it will be a little pain because they have to change their habits.

For searching I always use Ctrl+F. And if you don't need F3 for any other purpose, just use that for searching as well. You're covered for both cases then :)

Also see this blog post by Joel.




回答2:


I don't know when or who used Ctrl+H first, but the reason is very simple: Ctrl+F find, Ctrl+G (the next key on QWERTY) for find next, and Ctrl+H (the next one) for replace.

The same happends with copy-paste, Ctrl+C has a logical meaning, but X for cut and V for paste are the adjacent keys.

I would rather use H than R for consistency. R is also used to run scripts in some programs. And I have notice that most of the people don't use these shortcuts and won't try, Ctrl+R but the ones who are used to them may use Ctrl+H or check it.




回答3:


CTRL+R is part of the formatting shortcut keys in office, it right justifies the selected text or current paragraph. As this function is probably used more than search and replace it makes sense to give it CTRL+R

The MS UX guidelines (not that they stick to it themselves) has a keyboard section where they indicate that you should use the Windows OS shortcut keys to map to similar functions - so CTRL+H it is.




回答4:


I think Ctrl+H came from WordPerfect. Or, maybe H for repHace :O) (I am serious.)

Stick with Ctrl+H. Most applications use Ctrl+H. Don't confuse your users. Don't force your users to remember one-off shortcut keys. Don't annoy your users. They will not remember or bother to remember or think it is a bug.




回答5:


We not simply map the action to both shortcuts so that both Ctrl+R and Ctrl+H will do the same?

Alternatively, you could make it a configurable option so that the user can decide which one they want to use.



来源:https://stackoverflow.com/questions/1420288/search-and-replace-whats-the-proper-shortcut

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!