[Top][All Lists]

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

Re: [Nano-devel] tab completion in the browser

From: Benno Schulenberg
Subject: Re: [Nano-devel] tab completion in the browser
Date: Mon, 25 Apr 2016 17:41:57 +0200

On Sun, Apr 24, 2016, at 17:49, Rishabh Dave wrote:
> On Sun, Apr 24, 2016 at 1:16 AM, Benno Schulenberg <address@hidden>
> > One small improvement would be easy: both assignments to path_for_tab_c
> > are immediately followed by goto change_browser_directory, so it would be
> > cheaper and more central to set path_for_tab_c there, a little later, after
> > the assignment to path.  Which means that you don't have to do the first
> > assignment of "./" at all (which, by the way, was misplaced: it is among
> > the declarations).
> These changes are brought in tab-completion-improved.patch.

Hmm.  What is this supposed to do?:

+       if (dirname[strlen(dirname) - 1] != '/') {
+           dirname = realloc(dirname, PATH_MAX + 1);
+           strcat(dirname, "/");
+       }

Who says that dirname is at least one character long?  Maybe
dirname is the empty string?  And it allocates far too much
memory for just one slash.

Anyway, without your patch, when I run 'src/nano' and type
^R co <Tab> <Tab>, I get a list of filenames that start with
"co".  With your patch, it just beeps and beeps and beeps,
and never shows anything.

You not only have to set the global variable when arriving in
the browser, but also whenever doing a ^R or ^O.  In those
latter cases you set it to "./".

(The below is with your second patch.)

Also, when I do 'src/nano' and then type ^R ^T <Enter> ^C,
nano aborts.  (I have MALLOC_CHECK_ and MALLOC_PERTURB_ set.)
In browser.c you cannot simply copy path to path_save, because
path is freed later; you have to mallocstrcpy it.

See attached patch; this works for me.

1) The inserted assignments for path_save need better places.
2) path_save needs a better name -- where_we_are is what
I would call it.
3) Please provide a patch generated with git.
4) Please don't use HTML email, but just plain text.


-- - Access your email from home and the web

Attachment: tabbing-for-in-and-out.patch
Description: Text Data

reply via email to

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