dbuenzli / down

An OCaml toplevel (REPL) upgrade
http://erratique.ch/software/down
ISC License
84 stars 3 forks source link

Analog to utop’s accept-current-phrase #24

Open llelf opened 5 years ago

llelf commented 5 years ago

utop has a UTop.end_and_accept_current_phrase command. What it basically does is “send ;; \n without displaying them”. You can bind¹ to, say, Meta-ENTER and it’s quite handy.

¹) e. g.

#require "lambda-term";;
LTerm_read_line.bind
      [ { control = false; meta = true; shift = false; code = Enter } ]
      [ UTop.end_and_accept_current_phrase ]
    ;;
dbuenzli commented 5 years ago

What's the use of not displaying them ? What's written in the history then ?

dbuenzli commented 5 years ago

In fact I was not aware you could capture Meta-ENTER. I may actually prefer to use it for this.

But that doesn't prevent of providing what you suggest under another binding.

llelf commented 5 years ago

@dbuenzli just for the looks, they are written in the history. Not displaying them is not important I guess.

dbuenzli commented 5 years ago

Ok thanks for the answer. I think I rather not make what is different in history than what you can see in the "displayed history" so I think I would opt to make the append visible.

dbuenzli commented 5 years ago

Also could you please do

# Down.Private.tty_test ();;

and hit your M-enter and report me what is displayed.

llelf commented 5 years ago

M-\x0D (macOS’ Terminal.app)

vogler commented 5 years ago

https://gist.github.com/hcarty/b2dab5324d0d4344d771 👍 Got used to not typing/seeing ;; (alt+enter for multi-line without accept if needed).