Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#846279: ghc: Problems with Backspace, Delete and arrow keys

133 views
Skip to first unread message

Richard Smith

unread,
Nov 29, 2016, 3:10:03 PM11/29/16
to
Package: ghc
Version: 8.0.1-14
Severity: normal

Dear Maintainer,

Since upgrading to ghc 8.0.1, when trying to backspace user-entered text (e.g. a getLine event) in a
running haskell program (whether compiled with this version of ghc, or interpreted), the terminal
displays "^?" for backspace, "^[[3~" for delete and other codes for arrow keys.

It appears to be previously reported, and resolved, here: https://ghc.haskell.org/trac/ghc/ticket/2606

Looks to be a problem with how ghci is compiled and libedit/libreadline/ncurses-dev as the module
"System.Console.Editline.Readline" is missing:

GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Prelude> :browse System.Console.Editline.Readline

<no location info>: error:
Could not find module ‘System.Console.Editline.Readline’
It is not a module in the current program, or in any known package.


Many thanks!

-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.8.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages ghc depends on:
ii dpkg 1.18.15
ii gcc 4:6.1.1-1
ii libbsd-dev 0.8.3-1
ii libc6 2.24-5
ii libc6-dev 2.24-5
ii libffi-dev 3.2.1-6
ii libffi6 3.2.1-6
ii libgmp-dev 2:6.1.1+dfsg-1
ii libgmp10 2:6.1.1+dfsg-1
ii libncurses5-dev 6.0+20160917-1
ii libtinfo5 6.0+20160917-1

ghc recommends no packages.

Versions of packages ghc suggests:
pn ghc-doc <none>
pn ghc-prof <none>
pn haskell-doc <none>
pn llvm-3.7 <none>
ii perl 5.24.1~rc3-3

-- no debconf information

Ilias Tsitsimpis

unread,
Nov 30, 2016, 6:10:03 AM11/30/16
to
Control: tags -1 + moreinfo

Hi Richard,

On Tue, Nov 29, 2016 at 07:59PM, Richard Smith wrote:
> Since upgrading to ghc 8.0.1, when trying to backspace user-entered text (e.g. a getLine event) in a
> running haskell program (whether compiled with this version of ghc, or interpreted), the terminal
> displays "^?" for backspace, "^[[3~" for delete and other codes for arrow keys.

This is the indented behavior of getLine. It has always been like this,
and didn't change with ghc v8.0.1.

> It appears to be previously reported, and resolved, here: https://ghc.haskell.org/trac/ghc/ticket/2606

Please see comments 19 to 22 from the above ticket. They describe how
getLine is supposed to work, and how to get the indented results using
haskeline instead.

Does the above resolve your issue?

--
Ilias

Ilias Tsitsimpis

unread,
Dec 1, 2016, 9:20:03 AM12/1/16
to
Hi Richard,

On Wed, Nov 30, 2016 at 08:28PM, Richard Smith wrote:
> The issue is happening before getLine receives the user's input. So, suppose I
> have a basic function that asks for my name and then echoes it back to the
> terminal; if I make a typo while inputting my name and then try to backspace to
> correct, the console will display the "^?" characters. E.g.

Unfortunately, I cannot reproduce this. Backspace works as expected for
me for the following program:

$ echo "main = getLine >>= putStrLn" > Test.hs
$ ghc -o test Test.hs

using both v7.10.3 and v8.0.1.

Could you please try the following program in C:

================== %>< ============================
#include <stdio.h>

int main(void)
{
char s[32];

fgets(s, 32, stdin);
printf("%s", s);
return 0;
}
================== ><% ============================

Does backspace work in that case?

--
Ilias
0 new messages