jart / bestline

ANSI Standard X3.64 Teletypewriter Command Session Library
Other
443 stars 29 forks source link

feature request: readline-style transponse #12

Closed leahneukirchen closed 2 years ago

leahneukirchen commented 2 years ago

In readline and editline (and zle and emacs), CTRL-T transposes two letters as in bestline, but with the following addition: if cursor is at eol, swap the two last letters:

> ab<CTRL-T>
> ba

readline also implements this for ALT-T to transpose the last two words:

$ foo bar<ALT-T>
$ bar foo
jart commented 2 years ago

CTRL-T is an easy fix. I can do ALT-T at end of line too, however it's going to slightly differ from readline for the time being in terms of corner cases with spacing. Let me know if it works out for you!

leahneukirchen commented 2 years ago

Looks good, thanks!