搜索和替换:正确的快捷方式是什么?
非常简单的困境。用户需要能够在大段文本中进行搜索和替换。执行此操作的代码是小菜一碟。那里没有问题。效果就像一个魅力!别为此伤透脑筋。就这样解决了!这不是问题...
不,问题是为此函数定义一个好的快捷方式。虽然我更喜欢使用 CTRL+R 作为此功能的快捷方式(以及 CTRL-F 来查找文本)我注意到 Microsoft 使用 CTRL-H 作为快捷方式! (F3 用于查找文本,尽管 CTRL+F 大多数情况下也有效。)
那么,这个简单功能的首选快捷键应该是什么? CTRL-R 或 CTRL-H
第二个问题是附加点:CTRL在哪里kbd>-H从何而来? H 是什么意思?至少,R 代表替换,但 H ???
这与 Windows 应用程序的 GUI 设计有关。虽然是小事,但符合普遍接受的规范就好了!虽然 GUI 并不总是受到程序员的欢迎,但保持 GUI 与规范一致绝对与编程相关!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我不知道什么时候、谁首先使用了 Ctrl+H,但原因很简单:
Ctrl+F 查找,Ctrl+G(QWERTY 上的下一个键)查找下一个,Ctrl+H(下一个)进行替换。
复制粘贴也会发生同样的情况,Ctrl+C具有逻辑含义,但X用于剪切,V用于粘贴的是相邻的键。
为了保持一致性,我宁愿使用 H 而不是 R。 R 还用于在某些程序中运行脚本。我注意到大多数人不使用这些快捷键,也不会尝试,Ctrl+R,但习惯它们的人可能会使用Ctrl+H 或检查它。
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.
虽然我也认为 Ctrl+R 是更“明显”和“自然”的替换选择,但我会选择 Ctrl+ H 因为一致性原因。如果用户习惯使用 Ctrl+H 来替换文本(例如,因为他们使用 MS Word),那么如果它也适用于您的应用程序,他们会很高兴。然而,如果不起作用,就会有点痛苦,因为他们必须改变习惯。
对于搜索,我总是使用 Ctrl+F。如果您不需要 F3 用于任何其他目的,也只需使用它进行搜索即可。那么这两种情况都涵盖了 :)
另请参阅 Joel 的这篇博客文章。
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.
CTRL+R 是 Office 中格式设置快捷键的一部分,它使所选文本或当前段落右对齐。由于此功能可能比搜索和替换使用得更多,所以给它 CTRL+R 是有意义的
MS UX 指南(并不是他们自己坚持的)有一个 键盘部分,其中指示您应该使用 Windows 操作系统快捷键 映射到类似的功能 - 所以 CTRL+H 就是这样。
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.
我认为 Ctrl+H 来自 WordPerfect。或者,也许 H 代表 repHace :O)(我是认真的。)
坚持使用 Ctrl+H。大多数应用程序使用 Ctrl+H。不要让您的用户感到困惑。不要强迫用户记住一次性快捷键。不要惹恼你的用户。他们不会记得或费心去记住或认为这是一个错误。
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.
我们不简单地将操作映射到两个快捷键,以便 Ctrl+R 和 Ctrl+H 都会执行相同的?
或者,您可以将其设为可配置选项,以便用户可以决定他们想要使用哪一个。
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.