+5

Advanced word separators

Emanuele D'Osualdo 6 years ago 0
The ability of specifying word separators is great.
However there are many cases where their treatment is a bit counter-intuitive (see below).

Proposal in brief: three separate settings (word breaks indicated by | )
  1. special_chars: they get treated as the current word_separators. i.e. word boundaries precede and follow them as in "bla |bla|:| bla"
  2. pre_word_separators: they introduce a word boundary only before themselves. e.g.: "bla|\bla| bla" but not "bla|\|bla| bla"
  3. post_word_separators: they introduce a word boundary only after themselves. e.g.: "bla |bla'|bla" (think of prime in math mode, not string quotes.)
Example: backslash in LaTeX.
If you consider backslash as a word separator in LaTeX, you end up not being able to select a command as a single word, by double clicking for example. But if you exclude it from the word separators two commands in a row would be considered as a single word e.g.: "\cmd\cmd".
My solution would make this work as expected and is general and clean enough to find applications in other use cases.