nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [Request] allow deleting a marked region without affect


From: Benno Schulenberg
Subject: Re: [Nano-devel] [Request] allow deleting a marked region without affecting the cutbuffer
Date: Tue, 16 Oct 2018 20:49:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

>>> +   /* Load cutbuffer from ZAP undo. */
>>> +   cutbuffer = openfile->current_undo->cutbuffer;
>>> +   cutbottom = openfile->current_undo->cutbottom;  
>>
>> Why is this needed?
> 
> Zapping never writes to the cutbuffer. If the zap is contiguous, the undo 
> will have a cutbuffer from the last zap in it, otherwise it will be NULL. 
> This loads that cutbuffer into the main cutbuffer so do_cut_text() can append 
> to it, or create it if NULL.

Hmm.  This is confusing...  The zap function as a whole should leave the
cutbuffer unchanged.  But when calling do_cut_text(), the zap function
uses a temporary cutbuffer, the one that is stored in the undo item, so
that what the zap function cuts is added to it (when the zap is contiguous),
so that the undo item contains all that was zapped, so that it can be undone.
Okay, now I understand.

But... this means that when you do cutbuffer = old_cutbuffer at the end,
the temporary cutbuffer itself is "lost in space": it is leaked.

>>> +   add_to_funcs(do_zap_text, MMAIN,
>>> +           N_("Zap Text"), WITHORSANS(zap_gist), TOGETHER,
>>> NOVIEW);  
>>
>> This needs to be placed near the end of the list, next to savefile,
>> to keep the help items paired.  And it should be BLANKAFTER instead
>> of TOGETHER.
> 
> Oops! I forgot that add_to_funcs() orders help items. Should it be after 
> find_bracket which is also !NANO_TINY, or should I open a new !NANO_TINY 
> after savefile?

A new one after savefile.

> I don't know how to fix this, but when zap is by copy, my help items are 
> paired and without the zap patch they aren't.

Strange.  What compile options do you use?  That is: output of 'nano --version'.

> The various combinations of compile and possibly runtime options throw off 
> alignment in help bar.

Of runtime options, only --restricted could throw off the alignment, but I
doubt that you use that.  Alignment should be fine for no options at all,
for --disable-justify, and for --enable-tiny.

> Have you changed the unicode arrows since 3.1?

No.  Nothing changed in the arrows since they were added, many versions back.

> Every left/right arrow in help menu and help bar is invisible. I can see the 
> up/down arrows, and I can paste the invisible left/right arrows to a 3.1 
> nano, but nano git won't show them.

Weird.  When I make a huge terminal, I see all four arrows (or triangles,
really).  You have a seriously strange machine.  :)

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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