nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] how Alt+6 should behave


From: Benno Schulenberg
Subject: [Nano-devel] how Alt+6 should behave
Date: Sat, 30 Jan 2016 15:51:40 +0100

Hello Rishabh,

On Fri, Jan 29, 2016, at 18:46, Rishabh Dave wrote:
> I passed 'copy_text' variable to 'copy_from_filestruct()' to let it know
> not to change line number while copying (i.e. ALT+6 case).

Your patch does not do what I expect.  But... I now see that my
bug report is deficient: it does not describe which behaviour I
/did/ expect.  :|

The normal behaviour for Alt+6 (when the mark is not on) is to
copy (or add) the current line to the cutbuffer, and move the
cursor down one line.  When something is marked, the marked
portion is copied to the cutbuffer, and the cursor is placed
at the end of the previously marked portion (so when the marking
was backward, the cursor is effectively moved to the other end
of the portion).  (That latter behaviour I find strange, but let's
leave that for now.)

Your patch breaks the normal, unmarked behaviour: move the
cursor one line down.

In the marked forward case, your patch moves the cursor back
to the beginning of the marked portion.  Very weird!

What I would expect when Alt+6 is pressed when a region is
marked (either backward or forward) is: for the cursor not to
move at all.  It should just copy the marked portion to the
cutbuffer, unset the mark, and leave the cursor wherever it
was at the moment that Alt+6 was pressed.  Nor should it
scroll the screen in any way.  So what you would see when
you press Alt+6 is: just the highlight of the marked portion
disappears, and for the rest /nothing/ changes.

So, in short: the solution is elsewhere, or will have to be
a little more complicated.


Interestingly, after reversing your patch and recompiling,
the first time I tried Alt+6 again, it segfaulted on me.
So there is something wrong with the current code.


> Patch is tested
> over default mode and by using -G, -B switches - all individually.

The --locking and --backup options are not relevant for this
piece of code.  Better would have been to test, say,  --cut
and --softwrap.

(Also, the whitespace was still not correct in your patch.
See the version that I tested, attached.  I also turned the
logic around, but that is just my preference.)

Benno

-- 
http://www.fastmail.com - The professional email service

Attachment: preventing-scroll-on-copy.patch
Description: Text Data


reply via email to

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