In Windows 10, where are stop characters defined for selecting/moving around text with Ctrl+arrow or Ctrl+Shift+arrow?

3

Windows (and probably most other OSes) have a nice feature that allows one to move around and select text more efficiently. When using Ctrl (+ Shift]) + left/right arrow, one can jump or select chunks of text (delimited by spaces, dashes and others). My problem is that I usually want this behavior to recognize and stop on a more extensive list of characters (for example the underscore _).

Is this behavior built in into Windows? Can it be overridden system-wide or by application developers?

matt

Posted 2017-04-18T12:37:13.173

Reputation: 491

Good question. I've always wanted to prevent programs from stopping the cursor on certain characters, such as the dash. – I say Reinstate Monica – 2017-04-18T14:48:26.947

Answers

3

We can experiment on this string (paste it into Notepad or something):

a!b@c#d$e%f^g&h*i(j)k-l=m_n+o{p}q[r]s|t\u`v~w/x<y>z?0.1;2'3:4"5

I found that !, $, %, (, -, +, {, }, [, |, \, and ? all have some effect on line breaking or character clustering. Weirdly, there seem to be multiple types of influence - they vary in whether they can break lines and whether a Control+Arrow stops before or after. (And the omission of ] is not an accident. The opening brace has special properties, but the closing one not so much.)

Each edit control in Windows has a word-breaking procedure. Such a procedure is responsible for:

  • Determining a given character's behavior with regard to word wrapping
  • Determining whether a character is a delimiter
  • Finding the beginning of the next/previous word/cluster relative to the current position

Most applications use the Windows default one, which as far as I can tell is not configurable. A given edit control or rich text control's word-breaking procedure can be set with the EM_SETWORDBREAKPROC window message. Generally this would be done by the application that owns the control, since the address of the procedure will only be guaranteed valid within that process. Programmatically, you might be able to create a thread inside a target application's process that sets a custom breaking procedure on your target controls, but there does not seem to be a less tricky way.

Ben N

Posted 2017-04-18T12:37:13.173

Reputation: 32 973

Wow, great answer. Too bad there's not a simple way to change this behavior. – I say Reinstate Monica – 2017-04-18T17:57:37.443