[Top][All Lists]

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

Re: [Nano-devel] Escape-Escape keyboard sequences

From: Mike Scalora
Subject: Re: [Nano-devel] Escape-Escape keyboard sequences
Date: Fri, 25 Mar 2016 07:10:39 -0600

On Wed, Mar 23, 2016 at 10:28 AM, Benno Schulenberg <address@hidden> wrote:

Hi Mike,

Thanks for the patch.

On Wed, Mar 23, 2016, at 12:27, Mike Scalora wrote:
> After trying several workarounds unsuccessfully, I've created a patch for
> nano to support some escape sequences used by iTerm, a terminal program on
> the Mac that is very popular among programmers.

Do you mean iTerm sec, or iTerm2?  Or doesn't that make a

iTerm2, as I understand it iTerm (1) is dead, no updates in over 5 years. The changes might work on the old iTerm but I have not investigated. 
> I'm happy to go into more detail why I think this patch should be accepted

Yes, please.

#1, Currently the Option-Left and Option-Right insert characters into the document which is some times hard to notice. Since many users already use these keystrokes for word-left/word-right it bring the task to a screeching halt to go back and fix the unintentional changes.#2, since these are unusual sequences there should be no danger of them affecting other (non-iTerm2) users.
> and I would be happy to revise the implementation.
> The escape sequences I added support for are:
> ^[^[[a  -  Option-<up-arrow> - home
> ^[^[[b  -  Option-<down-arrow> - end

Aren't Command+Left-arrow, Command+Riight-arrow used for
Home and End, that is: for beginning-of-line and end-of-line?
That is on Apple's list of standard shortcuts but doesn't apply to the two popular terminals. Most people I know use CTRL-a and CTRL-e since it works everywhere. I used to remap the HOME and END keys in Terminal but I skip around a lot and got tired of configuring it so I got used to the CTRL-A/E 

> ^[^[[c  -  Option-<right-arrow> - word_right
> ^[^[[d  -  Option-<left-arrow> - word_left
> nano then matches the use of these keystrokes by the command line editor.

You use lowercase letters here, but in the patch uppercase.
I suppose the latter ones are correct?

Sorry, I wrote the email from memory, the patch/code has the correct, upper case, values.

> Please let me know if you are open to accepting a patch for this and/or
> what adjustments you would like.

When the patch works, doesn't break anything, and adds
intuitive keybindings on one more terminal, it's fine with me.

About the patch itself...  I don't like the 'escescob' name.
First I made it into 'esc_esc', then into 'mac_esc' for more
contrast with 'escapes'.  If you find a still better name,
please use that.  Also, the thing can have just two values,
so better make it into a bool, for still more contrast with
'escapes'.  Further, instead of doing '&& !escescob', why
not put the escescob case first, then the setting of it,
and then the get_key_buffer_len() == 0 case?
This new patch should have all the changes you suggested.


-- - The professional email service


Attachment: option_arrows_2.patch
Description: Binary data

reply via email to

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