Emulating or using ANSII escape codes from code within a running program

I program non-gui with Ada 2012 on Macbook Pro Intel chip outputting to the terminal and want to use the equivalent of ANSII terminal escape codes to manipulate the cursor and terminal properties from within a running application. I am updating a TERM_IO Ada Package from a 1987 (US Naval Institute at Monterey, California) the uses Ada’s basic Input_output command “put(… ANSII… )“escape codes or equivalent. Or can I set my OSC Terminal types to VT100 or the like? I have not found any joy with Ncurses, and all its secondary needs, as apposed to just using a Ada package I can modify as I need.

Posted on Jan 5, 2023 6:02 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 5, 2023 6:34 PM

The Apple Terminal.app app supports DEC VT100 ANSI control sequences.


That’s the foundation for a number of apps, including the command line text editors.


Here’s a zsh example: https://github.com/molovo/color/blob/master/color.zsh


I’m unfamiliar with ANSI terminal handling in Ada, but apps in other languages using curses or other common libraries will work, as will sending raw ANSI control sequences. (As is shown in thar zsh example.)


There’s an ncurses port available in Homebrew.


More than you ever wanted to know about VT100 terminals, and control sequences: https://vt100.net/

4 replies
Question marked as Top-ranking reply

Jan 5, 2023 6:34 PM in response to michaelayres

The Apple Terminal.app app supports DEC VT100 ANSI control sequences.


That’s the foundation for a number of apps, including the command line text editors.


Here’s a zsh example: https://github.com/molovo/color/blob/master/color.zsh


I’m unfamiliar with ANSI terminal handling in Ada, but apps in other languages using curses or other common libraries will work, as will sending raw ANSI control sequences. (As is shown in thar zsh example.)


There’s an ncurses port available in Homebrew.


More than you ever wanted to know about VT100 terminals, and control sequences: https://vt100.net/

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Emulating or using ANSII escape codes from code within a running program

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.