Troubles with wordDelimiters

Tony Balinski ajbj at free.fr
Sat May 3 09:08:34 CEST 2008


Quoting Joerg Fischer <jf505 at gmx.de>:

> Nicolas Tardieu wrote:
>
> > and suppose that my cusor is the following position shown by [myCursor] :
> >
> >        aVecteurLambdaIntegre.multMatriceVecteur(aMatriceMasseLambda,
> > [myCursor]aVecteurLambda);
> >
> > If I press [Ctrl+RightArrow], the cursor does not stop at the ")" or at
> the
> > ";" or at the end of the line, but it jumps to the next line.
> > ...
> > Is it a bug?
>
> No, it's just what the action routine forward_word() triggered
> with Ctrl+RightArrow does.
>
> > How can I change this behaviour?
>
> Looking in the online help, finding
>
>     forward_word( ["tail"] ["nobell"] )
>     Moves the cursor to the beginning of the next word.
>     Word delimiters are user-settable, and defined by
>     the X resource wordDelimiters.  If the "tail"
>     argument is supplied the cursor will be moved to the
>     end of the current word or the end of the next word,
>     if the cursor is between words.
>
> and concluding to re-bind Ctrl+RightArrow to forward_word("tail").
>
> > Can I specify that "\n" is a word delimiter?
>
> No, \n is always a word delimiter - you can't change this with a user
> setting.

I also was bothered by this behaviour, so I wrote a patch to fix it. It
behaves better, I think, with word skipping. It adds new action routines
forward/backward_same(), where same refers to character classes, of which
there are: letters/digits/_, other graphic characters, control characters,
spaces, newline, other ascii characters; then delimiters. The
forward/backward_same() routines skip over a contiguous sequence of characters
of the same class. A "skipblanks" argument allows blanks next to the skipped
characters to be skipped too in the current direction. When bound to
ctrl-[shift-]right/left, you do have to hit the keys more often to skip words,
but you do get to stop at line ends etc.

You can find the patch here:
http://ajbj.free.fr/nedit/nedit5.5dev/patches/ForbackwardSame3.diff

Tony


More information about the Discuss mailing list