larsbrinkhoff / forth-mode

Wants to be the SLIME of Forth
GNU General Public License v3.0
61 stars 17 forks source link

Terminal escape sequences #14

Closed ellerh closed 7 years ago

ellerh commented 7 years ago

SwiftForth emits, e.g. when using see, the escape sequence ^[[6n and then waits. Apparently CSI 6n tells the terminal emulator to report the cursor position. I don't know how to disable this on the SwiftForth side, so maybe Emacs should handle a few of the standard escape sequences. This might also allow us to introduce some custom escape sequences for the communcation with the subprocess.

larsbrinkhoff commented 7 years ago

Right, I already added code to filter out escape sequences, in forth-scrub.

Just one suggestion: Did you try TERM=dumb?

ellerh commented 7 years ago

Just one suggestion: Did you try TERM=dumb?

Yes. Same problem. I also tried to connect SwiftForth with a pipe instead of a pty (process-connection-type = nil) but then SwiftForth doesn't print the normal prompt and exits after the second error.

larsbrinkhoff commented 7 years ago

I did some research. The cursor position query can be turned off with

:noname 0 0 ; 'get-xy !

Perhaps a SwiftForth backend should set up a Device Personality that disables all uses of terminal escape sequences.

ellerh commented 7 years ago

The cursor position query can be turned off with :noname 0 0 ; 'get-xy !

Indeed.

Perhaps a SwiftForth backend should set up a Device Personality that disables all uses of terminal escape sequences.

Yes, sounds reasonable.

larsbrinkhoff commented 7 years ago

There is now a file called backend/swiftforth.el where this could be done.

larsbrinkhoff commented 7 years ago

I believe this is fixed?