struggling with Escape Sequences for terminal control

22 views
Skip to first unread message

Hans Nikolaus Beck

unread,
Apr 13, 2026, 5:18:06 AMApr 13
to forum
Hi, 

First let me say that 'm a J beginner. I've searched in Wiki and this forum, but I#m still struggling to put out an escape sequence to control the terminal of jqt (background is an ASCII art project). 
So, for example,  I don't get "\033[38;5;0m\033[48;5;14m ABC \033[0m" into effect in J9.6, MacOs. The sequence is taken from another post in this forum.

It cannot be difficult. What do I oversee? Thanks in advance for any help :)

Best

Hans

bill lam

unread,
Apr 13, 2026, 5:38:02 AMApr 13
to fo...@jsoftware.com
I don't think jqt terminal support ascii escape sequence. You may try using jconsole.

To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.

Hans Nikolaus Beck

unread,
Apr 13, 2026, 1:27:49 PMApr 13
to forum, bill lam
Hi Bill, 

thanks for the answer. I was imprecise, sorry. I don't know how to put the "\033[38;5;0m\033[48;5;14m ABC \033[0m" string out as a sequence of ASCII code characters. The foreign 1!:2 throws the error "...0m... "ill-formatted" number. So what to do to push the string "\033[3..." out as bytes 27 91 51.... to stdout? I'm sure I'm missing here something simple...;)

Best

Hans

Henry Rich

unread,
Apr 13, 2026, 1:43:26 PMApr 13
to forum, bill lam
Strings are enclosed in single quotes, not double. Is that it? 

Henry Rich

Hans Nikolaus Beck

unread,
Apr 13, 2026, 3:17:38 PMApr 13
to forum, Henry Rich, bill lam
Hi, 
thank you for your answers :)
My misunderstanding were several things: 
- string is '...' not "..."
- the escape character must be given as for example 
   ESC =. a.{~16b1b
- this 0$'...' is needed

  so 
  0$(ESC,'[38;5;49;48;5;5m') (1!:2) 4  
give me the text/background color I was looking for :)

But I'm completely lost why it works :D 
What does the sequence above in fact do? And what is the difference to this in article in Wiki? (it's about ":)
(and in Jqt this sequence is just ignored - has no effect?)

Best

Hans

Henry Rich

unread,
Apr 14, 2026, 2:13:30 AMApr 14
to Hans Nikolaus Beck, forum, bill lam
I am away from my machine & cannot comment on the wiki question or Jqt. 

Consider

 (string) (1!:2) 4

The string is written out to the file, and then the result of the sentence is typed. 

When you write to a named file, the result of 1!:2 is (i. 0 0), but when you write to stdout the result is the character string x . Thus the string will be written to the console twice back to back, followed by LF. 

When you prefix the sentence with 0 $, the result of the sentence becomes an empty string, and the string x will be written to the console once, followed by LF. 

Apparently your front end responds differently to these typeouts.

Henry Rich

bill lam

unread,
Apr 14, 2026, 7:55:02 AMApr 14
to Hans Nikolaus Beck, forum, Henry Rich
Will this be easier to read?

 empty stdout (ESC,'[38;5;49;48;5;5m') 

Reply all
Reply to author
Forward
0 new messages