Friday, April 05, 2013

[qklkagde] Word separators

Traditionally, moving a cursor through text by "words" (e.g., Emacs forward-word) places the cursor only at the beginning of words, a whitespace to non-whitespace transition.

Use a finer granularity and allow the cursor to land on any transition between character classes.  I often find myself wanting this, and think it can provide better, faster navigation.  Landing at the end of a "word" is especially needed if only Backspace but not Delete (under cursor) is available on the keyboard.

All upper case letters are in their own character class, all lower case in their own, all numbers in their own, and the space (ASCII 32 decimal) is in its own character class.  Every other character is, like space, individually in its own character class.

Example.  Asterisks designate where the word-navigation cursor may land.

Bar bar-bar bar bar's BARbar Bar BAR barBar "Bar bar." ((Bar))

*B*ar* *bar*-*bar* *bar* *bar*'*s* *BAR*bar* *B*ar* *BAR* *bar*B*ar* *"*B*ar* *bar*.*"* *((*B*ar*))*

Perhaps also allow the cursor to land in between parentheses especially if parenthesized expressions are being highlighted by an IDE, so sometimes there is a transition between classes between identical characters.

No comments :