[Top][All Lists]

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

Re: [Nano-devel] [PATCH] browser: inaccessible directory remains unselec

From: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] browser: inaccessible directory remains unselected when tabbed in goto directory prompt
Date: Fri, 01 Jul 2016 12:15:09 +0200

On Thu, Jun 30, 2016, at 21:37, Rishabh Dave wrote:
> Patch for the bug - - is 
> attached.
> Basically, path returned by functions responsible for tab completion
> has a slash at the end while path in filelist[selected] never has.
> Thus, strings holding same path are unequal only due to a slash. This
> is the cause to why inaccessible directory is not selected if tab is
> used.

Thanks.  The patch is good.  But I don't like the extra variable,
so I would write things more densely:

+           /* Snip a trailing slash, so the name can be compared. */
+           if (strlen(newpath) > 1 && newpath[strlen(newpath) - 1] == '/')
+               newpath[strlen(newpath) - 1] = '\0';

This calls strlen() three times, but we are not in a hurry here.
And... maybe the compiler is smart enough to not actually make
that call three times in a row.

If you can live with the above code, send in a signed-off patch.


-- - Access your email from home and the web

reply via email to

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