nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [PATCH] add an "atends" configuration setting


From: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] add an "atends" configuration setting
Date: Sun, 29 Apr 2018 13:02:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

Op 28-04-18 om 23:43 schreef address@hidden:
> With this setting on, Ctrl+Right and Shift+Ctrl+Right go to the end of a word
> instead of the beginning,

Yes, that would be useful.  My biggest annoyance with Ctrl+Right is
when I want to extend a comment: instead of jumping to the end of
the word before the period, it jumps to somewhere in the next line
and I have to do several cursor movements to get back to the end of
the comment text.

> The new behaviour of Ctrl+Down and Shift+Ctrl+Down comes from applying the 
> same
> logic for blocks instead of words.

I don't think that is very useful.  Anyway, it should be a separate
patch, it is not a necessary element for changing the behavior of
Ctrl+Left and Ctrl+Right.

> +.B set atends
> +Make Ctrl+Right and Shift+Ctrl+Right move at the end of words.
> +Make Ctrl+Down and Shift+Ctrl+Down move at the end of blocks.

Documentation is also needed in nano.texi.

I don't like the "atends" name.  It sounds too much like "attends",
and it starts with the same letters as "atblanks".  I prefer options
to have contrasting names.  Maybe "totails", or "toends"?

>  /* Move to the next word.  If allow_punct is TRUE, treat punctuation
>   * as part of a word.   When requested, update the screen afterwards.
> + * If at_ends is TRUE, move to the end of the word instead of the beginning.

The added comment is not clear enough.  Better: "stop at the ends of
words instead of at their beginnings".

> -             /* If this is not a word character, then it's a separator; else
> -              * if we've already seen a separator, then it's a word start. */
> -             if (!is_word_mbchar(openfile->current->data + 
> openfile->current_x,
> -                                                             allow_punct))
> -                     seen_space = TRUE;
> -             else if (seen_space)
> -                     break;
> +             if (!at_ends) {
> +                     /* If this is not a word character, then it's a 
> separator; else
> +                      * if we've already seen a separator, then it's a word 
> start. */
> +                     if (!is_word_mbchar(openfile->current->data + 
> openfile->current_x,
> +                                                                     
> allow_punct))
> +                             seen_space = TRUE;
> +                     else if (seen_space)
> +                             break;

If the only needed change is indentation, don't change the line.
Whitespace can be adjusted later.

> +             } else {
> +                     if (!is_word_mbchar(openfile->current->data + 
> openfile->current_x,
> +                                                                     
> allow_punct)) {
> +                             if (seen_word) {
> +                                     break;
> +                             } else {
> +                                     seen_space = TRUE;
> +                             }
> +                     } else {
> +                             if (seen_space) {
> +                                     seen_word = true;
> +                             }
> +                     }
> +             }

Please use nano's style and drop all the superfluous braces.

> +/* Move to the previous block in the file and update the screen afterwards.
> + * If AT_ENDS flag is set, stop at block ends too. */
> +void do_prev_block_void(void)

The second line of the comment is misplaced.

> +/* Move to the next block in the file and update the screen afterwards.
> + * If AT_ENDS flag is set, stop at block ends too. */
> +void do_next_block_void(void)

There is no need for these wrapper functions.  The block routines get
called only by the keystrokes they are bound to; they are not called
from anywhere else -- the browser only uses their names but does not
call them.

>  /* Move to the previous word in the file, treating punctuation as part of a
> - * word if the WORD_BOUNDS flag is set, and update the screen afterwards. */
> + * word if the WORD_BOUNDS flag is set, and update the screen afterwards.
> + * If AT_ENDS flag is set, stop at word ends too. */
>  void do_prev_word_void(void)

Again, misplaced comment.

> +     {"atends", AT_ENDS},

Also needs a command-line option.  At least a long one.

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]