nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] Implement multiple buffer count display


From: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] Implement multiple buffer count display
Date: Fri, 1 Sep 2017 21:36:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1


Op  1-09-2017 om 19:15 schreef Marco Diego Aurélio Mesquita:
>      unlink_opennode(openfile->prev);
>
> +    firstfile = openfile;
> +

This is wrong.  Firstfile should be changed only when the deleted node
WAS the first file.  So instead this should be added to unlink_opennode:

    if (fileptr == firstfile)
        firstfile = firstfile->next;


>       if (!close_buffer())
>  #endif
>           finish();
> +    total_refresh();

This is a waste.  When only a refresh of the title bar is needed,
refreshing the entire screen is a waste of resources.

>      /* Only print the version message when there is room for it. */
> -    if (verlen + prefixlen + pathlen + pluglen + statelen <= COLS)
> +    /* Conditionally replace branding by the number of buffers */
> +    int display_ind = asprintf(&buffer_indication, "[%d/%d]",
> +buffer_pos(openfile->prev), buffer_pos(firstfile->prev));
> +    int b_ind_len = strlen(buffer_indication);
> +    if(buffer_pos(firstfile->prev) != 1 && !inhelp && display_ind) {
> +  verlen = b_ind_len;
> +  branding = buffer_indication;
> +    }

The variable b_ind_len is superfluous.  What's more, the third call to
buffer_pos() is superfluous: the test firstfile != firstfile->next is
faster.

Benno




reply via email to

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