How to output text to the terminal, but not the T-Deck display


Would it be possible to add a stream type for outputting only to the repl? When working on something like the t-deck, the screen and the repl both display the same textual info when writing to the default output. If I want to display something only on the screen I can use with-gfx. However if I want to print something only to the repl this doesn’t seem possible (unless I missed it). This becomes an issue when I’m using the screen for graphics and I want to output debug info to the repl only.

What would you like to see in uLisp in 2024?

I think the neatest way to do this is by defining a couple of terminal control codes to turn off or on output to the screen. I’ve used 14 (Shift Out) to turn off output to the screen, and 15 (Shift In) to turn it back on.

To implement this, add the following lines to the start of the routine Display(), after the existing declarations:

  static bool displayDisabled = false;
  if (c == 14) displayDisabled = true;
  if (c == 15) displayDisabled = false;
  if (displayDisabled) return;

Here’s an example of its use:

> (write-byte 14)


> (print "hello")


but not displayed on the screen. To turn the screen back on:

> (write-byte 15)



Ok I’ll give that a shot, thanks!