双击或三次“单击以选择文本”的行为约定特征?

发布于 2024-08-27 07:16:51 字数 435 浏览 10 评论 0原文

几乎所有涉及文本的成熟程序都实现“双击以选择单词”,并且在某些情况下,“三次单击以选择其他内容,例如整行”作为功能。我发现这些功能很有用,但它们在程序之间通常不一致。

示例 - 某些程序的双击不会选择单词后的结尾空格,但大多数程序都会这样做。有些人将 - 字符识别为单词的结尾,而其他人则不然。当我写这篇文章时,我喜欢在三次单击时选择整个段落,VS web Developer 2005 不支持三次单击,而 ultra-edit 32 将在三次单击时选择一行。关于跨程序如何实现双击和三次单击模式匹配,我们可能会发现无数不一致的地方。

如果没有其他人达成关于模式匹配应如何工作的约定,我担心如何在我的程序中实现此行为。

我的问题是,是否存在一个约定(约定?可能是 MS 或 Linux 约定?)来规定这些功能应该如何对最终用户表现?如果有的话,它们是什么?

Almost any mature program that involves text implements "double click to select the word" and, in some cases, "triple click to select additional stuff like an entire line" as a feature. I find these features useful but they are often inconsistent between programs.

Example - some programs' double clicks do not select the ending space after a word, but most do. Some recognize the - character as the end of a word, others do not. SO likes to select the entire paragraph as I write this post when I triple click it, VS web developer 2005 has no triple click support, and ultra-edit 32 will select one line upon triple clicking. We could come up with innumerable inconsistencies about how double and triple click pattern matching is implemented across programs.

I am concerned about how to implement this behavior in my program if nobody else has achieved a convention about how the pattern matching should work.

My question is, does a convention (conventions? maybe an MS or Linux convention?) exist that dictates how these features are supposed to behave to the end user? What, if any, are they?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

雅心素梦 2024-09-03 07:16:51

我不认为存在您想要的规范级别的标准,而且可能也不应该存在。 Apple 人机界面指南是最重要的完全的。关于选择内容(而不是控件或离散数据对象),他们说:

双击最常用作其他操作的快捷方式,例如...选择单词。单击三次可选择应用程序定义的下一个逻辑单元。在文字处理文档中,在单词中单击三次即可选择包含该单词的段落...。在单词内双击可选择该单词。选择应提供“智能”行为;例如,如果用户删除了选定的单词,则该单词后面的空格也应该被删除……在某些上下文中(例如,在编程语言中),允许用户同时选择左括号和右括号(或一对中的大括号或中括号)以及它们之间的所有字符,方法是双击其中一个。” (p115-116)

Apple 对于单词中包含哪些字符以及不包含哪些字符非常明确。

Microsoft 的 Windows 用户交互体验指南 指出:

对于某些类型的可选对象,每次单击都会扩展单击的效果。例如,单击文本框设置输入位置,双击选择单词,三次单击选择句子或段落。 (p430)

Java Swing 外观设计指南说:

双击(快速连续单击鼠标按钮两次而不移动鼠标)用于选择较大的单位(例如,选择文本字段中的单词)......。三击(快速连续单击鼠标按钮三次而不移动鼠标)用于选择更大的单位(例如,选择文本字段中的整行)......。在一行文本中单击三次将取消选择任何现有选择并选择该行。

Gnome 人机界面指南 没有过多说明双击和三击应该做什么。

这使您可以自由选择最适合您的用户的内容。双击和三次单击是专家的快捷方式,因此他们的行为应该旨在最大限度地提高效率。考虑用户选择某些内容的原因,并进行设计以使其最简单、最快。

例如,显然,双击单词时包含尾随空格的基本原理是,用户通常选择一个单词,以便将其复制或粘贴到文本中的另一个位置。这意味着您自动包含尾随空格,以便用户不必手动删除源中剩余的额外空格并在目标中添加单词分隔空格。

同样,如果用户选择一行代码或段落将其复制或移动到其他位置,那么您可能需要包含换行符,这样用户就不会在源代码处留下空行,并强制在以下位置手动添加换行符目的地(假设他们不想采用该行/段落并将其与另一行/段落组合。

如果选择的目的不是复制和移动句子中的文本,那么这些都可能不适用,并且您不一定想要包含尾随空格或换行符,这就是为什么不应该有一个标准。

另一种方法是执行 Apple 所谓的智能剪切和粘贴(请参阅人机界面指南)或 Microsoft Word 的智能剪切和粘贴,其中包含空格和换行符。和其他调整是在剪切、复制、粘贴和删除时通过算法计算出来的,而不是在选择时计算出来的。

I don’t believe there is a standard to the level of specification you want, and there probably shouldn’t be. Apple Human Interface Guidelines are the most complete. With respect to selecting content (as opposed to controls or discrete data objects), they say:

Double-clicking is most commonly used as a shortcut for other actions, such as… to select a word. Triple-clicking selects the next logical unit, as defined by the application. In a word-processing document, triple-clicking in a word selects the paragraph containing the word…. Double-clicking within a word selects the word. The selection should provide “smart” behavior; if the user deletes the selected word, for example, the space after the word should also be deleted… In some contexts—in a programming language, for example—it may be appropriate to allow users to select both the left and right parentheses (or braces or brackets) in a pair, as well as all the characters between them, by double-clicking either one of them.” (p115-116)

Apple is quite specific about what characters are and aren’t included in a word.

Microsoft’s Windows User Interaction Experience Guidelines say:

For some types of selectable objects, each click expands the effect of the click. For example, single-clicking in a text box sets the input location, double-clicking selects a word, and triple-clicking selects a sentence or paragraph. (p430)

Java Swing Look and Feel Design Guidelines say:

Double-clicking (clicking a mouse button twice in rapid succession without moving the mouse) is used to select larger units (for example, to select a word in a text field)…. Triple-clicking (clicking a mouse button three times in rapid succession without moving the mouse) is used to select even larger units (for instance, to select an entire line in a text field)…. A triple click in a line of text deselects any existing selection and selects the line.

The Gnome Human Interface Guidelines don’t say much about what double- and triple-clicking should do.

This gives you the freedom to choose whatever is best for your users. Double and tripling clicking are expert shortcuts, so their behavior should aim to maximize efficiency. Consider why the user is selecting something and design to make that easiest and fastest.

For example, apparently the rationale behind including the trailing space when double-clicking a word is that users usually select a word in order to copy or paste it in another position in the text. This implies you automatically include the trailing space in order keep the user from having to manually delete a remaining extra space at the source and add a word-separating space at the destination.

Likewise if users are selecting a line of code or paragraph to copy or move it somewhere else, then you probably want to include the newline characters so the user isn’t left with an empty line at the source and force to manually add a newline at the destination (assuming they didn’t want to take the line/paragraph and combine it with another line/paragraph.

If selection is for something other than copying and moving text in sentences, then none of this may apply and you don’t necessarily want to include trailing spaces or newlines. That’s why there shouldn’t be a standard.

An alternative is to do what Apple calls Intelligent Cut and Paste (see the Human Interface Guidelines), or Microsoft Word’s Smart Cut and Paste, where spaces, newlines and other adjustment are algorithmically figured out when cutting, copying, pasting, and deleting, not when selecting.

深海夜未眠 2024-09-03 07:16:51

在我的完美世界中,我会让它像这样工作。

  • 双击一个单词仅选择该单词(根据区域设置的语法规则的单词),没有尾随空格(这是为了更容易在程序之间复制,这样我就不需要删除任何空格粘贴时)
  • 如果我删除所选单词,我的文本编辑器会识别我的内容并删除剩余的任何其他空格
  • 三次单击选择没有尾随换行符的行。 (段落是已换行的长行)

In my perfect world I would have it work like this.

  • Double click on a word selects the word only (a word according to the grammar rules of the locale), no trailing space (this is for easier copying between programs so that I would not need to remove any spaces when pasting)
  • If I remove the selected word my text editor is aware of my content and removes any additional spaces left over
  • A triple click selects a line with no trailing newlines. (A paragraph is a long line that has been wrapped)
梦情居士 2024-09-03 07:16:51

在 Windows、Linux 和 OS X 中,双击选择光标下的单词,三次单击选择整行文本(仅限单行,即换行)

In Windows, Linux and OS X double-click selects the word under cursor triple-click selects the entire line of text (single line only, i.e., wrapped line)

分開簡單 2024-09-03 07:16:51

寻找答案并提出替代解决方案:
我喜欢以文本形式编写代码或命令,然后将它们复制到 shell 提示符,而不以结尾 \n
1.使用记事本
2. 每行用 () 括起来
3.使用ctrl+双击。
美好的...

Finding answers and come up with a alternative solution:
I like to write code or command in text, and copy them to shell prompt without the ending \n
1. use notepad
2. surround each line with ()
3. use ctrl + double click.
Fine...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文