nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [Request] allow deleting a marked region without affect


From: Benno Schulenberg
Subject: Re: [Nano-devel] [Request] allow deleting a marked region without affecting the cutbuffer
Date: Mon, 15 Oct 2018 20:51:28 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Op 15-10-18 om 10:12 schreef Brand Huntsman:
>   * If cut_till_eof is TRUE, move all text from the current cursor
> - * position to the end of the file into the cutbuffer. */
> -void do_cut_text(bool copy_text, bool marked, bool cut_till_eof)
> + * position to the end of the file into the cutbuffer.  If append is TRUE,
> + * cuts are always appended to the cutbuffer. */

Here something seems to be inverted.  Because:

>       /* If cuts were not continuous, or when cutting a region, clear the 
> slate. */
> -     if (!keep_cutbuffer || marked || cut_till_eof) {
> +     if (!append && (!keep_cutbuffer || marked || cut_till_eof)) {

I think the parameter should be called 'zapping', and the comment
should read: "If zapping is TRUE, do not clear the cutbuffer."

> +     /* Load cutbuffer from ZAP undo. */
> +     cutbuffer = openfile->current_undo->cutbuffer;
> +     cutbottom = openfile->current_undo->cutbottom;

Why is this needed?

> +     /* Clear cutbuffer in undo. */
> +     openfile->current_undo->cutbuffer = NULL;
> +     openfile->current_undo->cutbottom = NULL;

And why this?

> +     do_cut_text(FALSE, openfile->mark, FALSE, TRUE);
> +
> +     update_undo(ZAP);

What needs to be updated in the undo item after the zapping?

> +     const char *zap_gist = N_("Cut current line (or marked region)");

"Throw away the current line (or marked region)"

>       add_to_funcs(do_copy_text, MMAIN,
>               N_("Copy Text"), WITHORSANS(copy_gist), BLANKAFTER, NOVIEW);
> +     add_to_funcs(do_zap_text, MMAIN,
> +             N_("Zap Text"), WITHORSANS(zap_gist), TOGETHER, NOVIEW);

This needs to be placed near the end of the list, next to savefile, to keep
the help items paired.  And it should be BLANKAFTER instead of TOGETHER.

> +     case ZAP:
> +             undidmsg = _("text zapped");

To keep in style with the other messages: "text zap".  The string
as a whole should be be understood as a noun.

> +                     case 'Z':
> +                             SET(ZAP_BSP_DEL);

I don't like the ZAP_BSP_DEL name, but don't know a better one, yet.

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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