nano-devel
[Top][All Lists]
Advanced

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

Re: <Tab> is not captured while selecting


From: Benno Schulenberg
Subject: Re: <Tab> is not captured while selecting
Date: Mon, 2 Dec 2019 16:55:02 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1

Hi Sébastien,

Op 02-12-2019 om 12:09 schreef Seb:
> I think I may have found a bug in Nano (I downloaded 4.6). I was trying to 
> write
> a hardcoded hash in Perl, where key/value pairs are separated by a "=>". I 
> first
> wrote the keys:
>     '10'
>     '20'
>     '30'
> then went back to the first line, ^E to go beyond the second apostrophe, then
> started selecting (Ctrl-^) and typed "<Tab>=> ". My intention was to cut this
> text (^K^U) and copy it below (^N^U, etc.).

Hmmm...  Interesting way of starting the action of selecting something *before*
you have typed the text that you want to select.  I do not posses this amount of
foresight.  :)

(In your particular example, I would have typed:    '10'<Tab>=> ^K^U^U^U, and
then gone back to type the stuff after the =>'s, and then changed the second
10 to 20, and third 10 to 30.)

> But after pressing <Tab>, instead of
> seeing a selected <Tab>, the entire line shifted to the right, including 
> "'10'".

Yes: nano-2.9.2 added a simple rule to the keyboard routine: when the mark is 
on,
<Tab> calls the indent function instead of inserting a Tab character.

> This selection process used to work, though; I used it countless times before.
> 
> Can this be mended?

We could change the rule so that <Tab> only means 'indent' when the cursor is
on a different line than the mark.  This would preserve the intention of the
function (to be able to indent a group of lines as a whole), without interfering
with your foresight selecting -- well: unless you type multiple lines, including
Tabs, while the mark is on.  Is there any chance you would do the latter?  If
yes, then you would simply have to delete lines 661 and 662 from src/winio.c.

But if you make only short foresight selections, then the attached patch
should fix the problem.

Benno

Attachment: tab-only-indents-when-mark-and-cursor-are-on-different-lines.patch
Description: Text Data

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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