5

When in Windows 7 I double-click in the text aaa.bbb, either aaa or bbb get selected but not both, so the selected text is that part only and not the whole string aaa.bbb.

As another example, double-clicking anywhere something of the form aaa_bbb selects the entire word - i.e. the character _ does not work as a separator.

Is there a way to change or add in Windows what delimiters are considered as word separators?

1
  • It is difficult to understand what you are asking. What is "form a.b"? Please clarify what program you are working with and what you are trying to do. Screen shots are helpful.
    – CharlieRB
    May 1, 2015 at 12:38

2 Answers 2

2
+50

There is no one unified mechanism in Windows for handling text selection. When issuing a double-click to a program, it receives that event and handles it using its own logic and code. Therefore you will get different behaviors from different programs. The results will be, for example, different in Notepad, Wordpad, Word etc. Even within Office, there will be differences on behavior and options between Word and Excel etc.

You will need to build a mechanism that intercepts double-click and does its own trick. A good tool would be AutoHotkey with which you could write a script that converts the double-click into a series of operations on the active program.

You will need to make certain assumptions on the user-interface, which might not apply to all programs, and you will need a mechanism for extracting data from the programs - for me the only universal one is the clipboard. This will conflict with any product that manages clipboard history, since you will be filling up its history list with partial data.

You will need to assume that the target program follows the usual conventions for moving the cursor and selecting characters.

The AutoHotkey script that you will write will do:

  • Intercept the double-click while remembering the target window and the X-Y coordinates of the click
  • Send a simple click to theses coordinates
  • Send Shift+Home to select all characters to the left
  • Send Ctrl+C to copy the characters and find out the number of characters L to select on the left
  • Send another simple click to theses coordinates
  • Send Shift+End to select all characters to the right
  • Send Ctrl+C to copy the characters and find out the number of characters R to select on the right
  • Send again a simple click to theses coordinates
  • Send L times a Left arrow
  • Send L+R times Shift+Right to do the selection
  • Done.

Remember to add a few milliseconds wait after issuing keys, to allow the target program the time to process them.

4
  • I assume the same applies to Ctrl+Shift+Left / Ctrl+Shift+Right, correct?
    – kyrill
    Mar 12, 2019 at 19:37
  • @kyrill: I have avoided using it in the above scenario. The definition of what is a word is different between products.
    – harrymc
    Mar 12, 2019 at 19:56
  • I don't mean the "definition of a word", but rather the handling of keyboard events. My question is whether the Ctrl+Shift+Left / Ctrl+Shift+Right shortcuts are handled by each application individually without the use of some system-wide settings, just as the double click is.
    – kyrill
    Mar 12, 2019 at 22:12
  • Yes, that's indeed the case. The definition of the delimiters is different for each product, and you can see that just by selecting text with double-click in notepad, wordpad, notepad++, word, visual studio etc. This is especially noticeable for editors of programming languages, when different characters are permitted in variable names and double-click needs to select that entire name.
    – harrymc
    Mar 13, 2019 at 7:03
0

I understand your question. I don't think you can change what Word thinks of as a word unit. However, if you want more consistent behavior, you could go into Options -> Advanced, and uncheck the second item, "When selecting, automatically select entire word".

1
  • I don't think he was asking for in ms word, but rather in general.
    – ecube
    May 30, 2015 at 2:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .