Ticket #106 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

Do not insert escape codes for unrecognised commands

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

Description

Currently for key combinations that haskeline does not recognise as mapping to a specific command, it inserts the raw escape characters. I can't see any use case where that is desirable behaviour. For example:

$ ghci
GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> 1;5C1;5D

(for the unrecognised key combo ctl-left ctl-right)

The bug here is not that this combo is not recognised, but that it does something surprising and counterproductive.

Unrecognised commands should either be ignored completely or they should elicit some explicit behaviour to indicate they are unrecognised. For example readline beeps/flashes the window when you go left when already at the beginning of the buffer. In that readline situation it's a recognised command that is inapplicable in the context; using the same behaviour for unrecognised commands seems sensible.

Change History

follow-up: ↓ 2   Changed 5 years ago by judah

  • owner set to judah
  • status changed from new to assigned

Thanks for the report; I'll look into changing it so it doesn't print out characters after a problem key sequence. One side-effect will be that if you paste a long string containing an unrecognized key sequence, everything after that key sequence will be ignored. But the issue you described seems like a bigger annoyance.

One thing, though: when I use ghci-6.12.1 and reproduce your above example, I do indeed hear a beep indicating that the command was not recognized. If you don't get any response when you try it:

  • What do you have in your .haskeline file?
  • What happens if you add the line bellStyle:VisualBell or bellStyle:AudibleBell to .haskeline?
  • Do you get a beep or flash when you tab-complete a nonexistent identifier?
  • What shell and terminal program are you using?

in reply to: ↑ 1   Changed 5 years ago by duncan

Replying to judah:

One thing, though: when I use ghci-6.12.1 and reproduce your above example, I do indeed hear a beep indicating that the command was not recognized.

Ah, I've switched machine from the one I was using when I filed this ticket. The machine I was using when I filed this ticket had the audible beep behaviour mapped to a window title bar flash. I'd have to test on that box again. This box has a different terminal config with no audible bell at all.

  Changed 4 years ago by judah

Fixed in 0.6.2.3 (to be released next week). Haskeline now beeps/flashes when you enter an unrecognized key sequence.

  Changed 4 years ago by judah

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.