New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backspace in raw mode #57

Piervit opened this Issue Jan 18, 2018 · 3 comments


None yet
2 participants
Copy link

Piervit commented Jan 18, 2018


I am playing with lambda-term(thanks) : version: 1.12.0 .
I have created a test program, I have a problem with the Backspace keyboard in raw mode: it appears it is not mapped to the correct key.

Running a LTerm_key.to_string show me the following result when I press the backspace key:

{ control = true; meta = false; shift = false; code = Char 0x68 }

For the other keys, it works well.
I use a "PC generic 105 keys", I got the bug with both a french or US international keyboard binding.

Thank you for lambda-term.

Here is the test program:

open Lwt
open Printf
open LTerm_key

exception ExitTerm of (LTerm.t * LTerm.mode)

let rec loop term history tmod =
  Lwt.catch (fun () -> (LTerm.read_event term)
    >>= fun event -> 
      match event with 
        | Key akey ->
            (** A key has been pressed. *)
                  (match akey.LTerm_key.code with
                    | Escape -> (ExitTerm (term,tmod))
                    | _ -> 
                        LTerm.fprints term (LTerm_text.eval [S (sprintf "%s\n" (LTerm_key.to_string akey))]) >>= 
                        (fun () -> loop term history tmod )
        | _ -> 
                loop term history tmod 
      | exn -> exn)

let main () =
  LTerm_inputrc.load ()
  >>= fun () ->
    (fun () ->
       Lazy.force LTerm.stdout
       >>= fun term ->
       LTerm.enter_raw_mode term >>=
         (fun tmod -> loop term (LTerm_history.create []) tmod )
      | ExitTerm (term, tmod) -> LTerm.leave_raw_mode term tmod 
      | exn -> exn)

let () = (main ())


This comment has been minimized.

Copy link

Piervit commented Jan 18, 2018

Hum, I have confess that running from a non graphic terminal, the backspace is matched.
So it is only in my GUI (xfce) but still, backspace works for other programs.


This comment has been minimized.

Copy link

diml commented Jan 18, 2018

Hi, I admit that I'm not working much on lambda term these days. notty looks more active, have you tried it?


This comment has been minimized.

Copy link

Piervit commented Mar 24, 2018

I add some times to look back at the issue: well I remarked that on some GUI terminals it was working while on others not. Then I have seen that xfce terminal had different compatibility mode for backspace (quickly translated from french):

  • automatic detection
  • escape sequence
  • CTRL-H
  • Escape TTY

So there is no trivial bugs in lambda-term, some terms just map backspace to CTRL-H... I am not sure lambda-term should do something for this, because when you are stuck in it... It is a big loss of time.

Piervit pushed a commit to Piervit/Gufo that referenced this issue Mar 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment