Using backspace key in serial monitor


#1

Hi

I have been thinking for long time now , why it doesn’t seem to work to use the backspace key in ulisp in case you make a mistake in typing…
Is this correct ?

Kind regards ,
Ronny


#2

I assume you’re communicating with uLisp via a serial terminal, rather than using the Serial Monitor in the Arduino IDE?


#3

Hi David,

Yes , I’m using GTK-Term under Linux. A very good terminal by the way.

Regards ,
Ronny


#4

The uLisp REPL loop simply does what it says - does a read to read the next atom or list, does an eval to evaluate it, and then does print to print it. It assumes that line editing, and handling of backspace, is done before you send the stream to uLisp.

In the Arduino IDE Serial Monitor you can edit the line you’re entering before pressing Return. Some terminals also provide this - they buffer the input, and you can delete characters before you’ve pressed Return. In my Lisp Badge I provided a buffer, and simple line editing, to achieve this.

You could write a buffer in uLisp that provides this feature; see this earlier post:

Simple Lisp program editor


#5

Aaah , thanks !
Didn’t know this.

Regards ,
Ronny


#6

Hi Ronny,

Some serial terminals allow you to change between character mode and line mode (Emacs for example). In character mode every key/character is sent immediatly (so [backspace] and similar don’t work in that case). In line mode, input is sent when you press [enter] (and [backspace] and similar work as expected).

Regards

rsm


#7

In Emacs, I found it helpful to define a function like this one to start a ulisp terminal in line mode directly:

(defun ulisp-terminal-start ()
  (serial-term "/dev/ttyUSB0" 9600)
  (term-line-mode))