haskell / haskeline

A Haskell library for line input in command-line programs.
https://hackage.haskell.org/package/haskeline
BSD 3-Clause "New" or "Revised" License
221 stars 75 forks source link

Haskeline seems to ignore my home and end press absolutely #30

Closed TorosFanny closed 8 years ago

TorosFanny commented 8 years ago

I simply write a ~/.haskeline file like the following for a test.

bind: home a
bind: end b

It shows that my ghci seems to ignore my home and end press absolutely.

So how could I send home and end key to haskline? I have being suffering from the lack of support for end key and home key of ghci for a long time.

Is any thing wrong with my environment? My laptop:

Ubuntu 14.04
ghc 7.10.2
haskeline-0.7.2.1
judah commented 8 years ago

See the instructions here for the "keyseq" option: http://trac.haskell.org/haskeline/wiki/CustomKeyBindings

Specifically, the instructions for ctrl-left/right should also work for home/end. Let me know whether that works for you.

TorosFanny commented 8 years ago

Yeah, ctrl-left/right works for me as pressing home/end, but I can't bind ctrl-home/end to any key. It seems that, haskline blocks my home/end.

TorosFanny commented 8 years ago

I finally worked out by this.

keyseq: "\ESCOH" home
keyseq: "\ESCOF" end

Thank you for your help. Buf it's really strange that haskeline blocks home/end, is that a bug?

judah commented 8 years ago

You're right, on second look it should be picking up the home/end keys automatically. Most likely this is a configuration issue with your terminal; what are the outputs of the following commands?

echo $TERM

infocmp

ghc -e 'System.Console.Terminfo.setupTermFromEnv >>= print . flip System.Console.Terminfo.getCapability System.Console.Terminfo.keyHome'

On my machine (Mac), the first is xterm-256color, the second contains khome=\EOH, and the third prints Just "\ESCOH". That's the information that lets Haskeline know the control sequences for the home key.

TorosFanny commented 8 years ago

A: I tried ghci in virtual box with Ubuntu 15.10, and home/end behaves normally. But, I'm not sure if Ubuntu 14.04 is borned with this issue or because of my configuration. B: The first is empty. The second contain's home=\E[H but no for end. The third is just Nothing

develop7 commented 1 year ago

Hi folks, https://github.com/unisonweb/unison/issues/3418 seems to match this issue precisely and I'm still affected, 7 years later, could you reopen it?

@judah the diagnostic snippet you've posted outputs exactly the same values on my machine except I'm running openSUSE Tumbleweed 20221008. I'd like to get to the bottom of the issue, any suggestions how to proceed?