Ticket #102 (closed defect: fixed)

Opened 8 years ago

Last modified 7 years ago

Haskeline does not recognize many keys that readline did

Reported by: josh Owned by:
Priority: major Milestone:
Version: Keywords:
Cc: duncan@…

Description (last modified by josh) (diff)

Having upgraded from GHC 6.8 to GHC 6.10, I noticed many regressions when using the new haskeline-based GHCi versus the previous readline-based GHCi. My fingers rebelled; filing this bug to request the recognition of additional keys by default.

First, key sequences that haskeline doesn't recognize:

keyseq: "\ESCOH" home
keyseq: "\ESCOF" end
keyseq: "\ESC[3~" delete
keyseq: "\ESC[1;5A" ctrl-up
keyseq: "\ESC[1;5B" ctrl-down
keyseq: "\ESC[1;5C" ctrl-right
keyseq: "\ESC[1;5D" ctrl-left

Second, bindings that haskeline doesn't recognize:

bind: ctrl-p up
bind: ctrl-n down

(Also ctrl-y for yank, but I haven't found that one yet.)

And third, bindings that readline doesn't have by default, but many distributions and users add to readline and thus allow in all readline-using apps:

bind: ctrl-left meta-b
bind: ctrl-right meta-f

Please consider adding these key sequences and bindings.

If any of these already exist in versions newer than that which shipped in GHC 6.10, my apologies.

Change History

Changed 8 years ago by josh

  • description modified (diff)
  • summary changed from Haskeline does not recognize to Haskeline does not recognize many keys that readline did

Changed 8 years ago by judah

What's the exact version of ghc that you're running?

Also, you can get a ghci-haskeline executable which uses the latest released version of Haskeline by running:

cabal update
cabal install ghci-haskeline

Can you please try that and report which of those bindings are still not available?

Changed 8 years ago by josh

~$ ghci --version
The Glorious Glasgow Haskell Compilation System, version 6.10.4
~$ dpkg -l ghc6
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                              Version                           Description
ii  ghc6                              6.10.4-1                          GHC - the Glasgow Haskell Compilation system

Changed 8 years ago by josh

OK, I installed ghci-haskeline with cabal, and tested it.

Ctrl-p, Ctrl-n, home, end, and delete all seem to work fine now.

Ctrl-left and Ctrl-right don't work by default, but I didn't really expect them to. :) Consider that part a wishlist item.

However, any chance of trying to get the new Haskeline into a GHC 6.10 point release or similar, to try to fix these regressions before 6.12?


Changed 7 years ago by duncan

  • cc duncan@… added

Adding myself to the cc list as a vote for the word left/right bindings

keyseq: "\ESC[1;5C" ctrl-right
keyseq: "\ESC[1;5D" ctrl-left

Changed 7 years ago by judah

  • status changed from new to closed
  • resolution set to fixed

Ok, I've pushed the following patches to make ctrl-left/right skip words by default:

Fri Apr 16 00:33:01 PDT 2010  Judah Jacobson <judah.jacobson@gmail.com>
  * Hard-code some defaults for ctrl-left/right.

Fri Apr 16 00:20:30 PDT 2010  Judah Jacobson <judah.jacobson@gmail.com>
  * Add Emacs bindings for ctrl-left/right to skip words.

Since there's no standard terminfo capability for ctrl-arrow-keys, I hard-coded some standard keysequences (including the one you mentioned above) which should allow it to work OK on most common terminals.

Changed 7 years ago by duncan

Yay! Thanks Judah. :-)

Note: See TracTickets for help on using tickets.