nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] browser: remove opendir() for KEY_WINCH


From: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] browser: remove opendir() for KEY_WINCH
Date: Tue, 28 Jun 2016 12:08:55 +0200

> On Mon, Jun 27, 2016 at 11:40 PM, Rishabh Dave <address@hidden> wrote:
> > We simulate/use KEY_WINCH at 2 places (both in the big if-else-else
> > statement in browser): (i) total_refresh and (ii) do_help_void. So, I
> > made arrangements at both places individually and then wrote a "goto
> > read_directory_contents" to reopen and re-enter current working
> > directory.

First, the goal is to remove duplicated code, and what you do is
add other duplicated code.  :|

Second, the indentation of the last two code blocks is wrong.  :|

Third, it is not necessary to check for null before freeing something
-- free(NULL) is fine.

Fourth, the idiom for freeing one string and copying it from another
is: thing = mallocstrcpy(thing, otherthing).

Fifth, it is not necessary at all to free present_name because when
entering the while true loop, present_name /will/ be null.

Sixth,
  if ((path == NULL || dir == NULL) && kbinput != KEY_WINCH)
bwah, that is ugly -- an error message should not depend on
what "key" is pressed.  And what does it do anyway?  If I remove
the "&& kbinput != KEY_WINCH", nano behaves the same way.

Ah, now I see.  It is meant to suppress a repetitive error message
when resizing the window, but to allow the message when doing
an explicit Refresh or coming back from Help.  Hmm.  It may be
slightly annoying, but how often will people resize their windows
when in the file browser /and/ in a directory that has become
unreadable?  Not worth a special treatment.

Also, try this:
  src/nano, and then type ^R ^T M-G doc <Enter>
In another terminal do: chmod a-x doc
Change the size of the window of nano, then type ^L
or ^G ^G.  For some reason you are now in the parent
dir, at its last file.  ??

Benno

-- 
http://www.fastmail.com - Access your email from home and the web




reply via email to

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