nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] bug #34898: [Request] reuse existing buffers wh


From: Rishabh Dave
Subject: Re: [Nano-devel] [PATCH] bug #34898: [Request] reuse existing buffers when adding files
Date: Fri, 4 Aug 2017 00:49:45 +0530

On Mon, Jul 24, 2017 at 11:50 PM, Benno Schulenberg <address@hidden> wrote:
> when doing:
>
>   src/nano  TODO  ./TODO  doc/../TODO  /full/path/to/TODO
>
> it will open the TODO file four times.  (When using --locking, it will
> recognize that it's four times the same file, and will warn about that.
> Your patch should be equally clever.)

Fixed. However, there were 2 methods to do that. First one I thought
was to check the i node number and second was to compare absolute path
names. While both (I tried both) I never found any document saying
that i node number stays with a file for life time. So, current patch
is the one that compares absolute path names.

> Also, the original requester, suggested that nano should switch to
> the buffer with the already-open file when the user tries to open it
> again.  I think that would be good.  And the message could then become:
> "File %s was already open".

Done.

Also patch was buggy against some tests (e.g., cases where a buffers
had no corresponding file due to being new, opening irrelevant buffer
when command line arguments has a buffer twice) and had memory leaks.
Both fixed. Commit message (of 0001) is also updated accordingly.

Also try the following -

src/nano TODO README a
^R M-F
Enter "a" at prompt

Normally, this would create another buffer for a. But with patch(es)
applied buffer "a" opens up.

By the way, patches attached aren't well tested. Recently I couldn't
find time. Just let me know if they are okay. I will resend well
tested, perhaps with some restructuring.

And... please ignore commit messages on patch 0002 and 0003. They are
not meant to be final commit messages.

To describe patches in short -

0001 is the same on as before with some improvements (the debugging
and leak fixes I was talking about above)
0002 has a minor change, which increases efficiency
0003 adds code to avoid buffers under same name

Attachment: 0001-files-don-t-create-a-new-buffer-if-a-file-already-ha.patch
Description: Text Data

Attachment: 0002-files-do-not-switch-buffers-unnecessarily.patch
Description: Text Data

Attachment: 0003-files-don-t-create-a-new-buffer-if-a-file-already-ha.patch
Description: Text Data


reply via email to

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