terminal.d with built-in emulator option releaed

Posted 2020-03-23

I finally released my built-in terminal emulator option on dub and marked it version 6.0... I was hoping to put in a cgi.d server control object too, but instead had to fix bugs in the websocket server and minigui widgets and ran out of time. Hopefully for 6.1 though.

Core D Development Statistics

In the community

Community announcements

See more at the announce forum.

What Adam is working on

So what is this new terminal.d thing? Well, it occur to me it is kinda like electron for text apps lol - it combines a terminal emulator GUI with a terminal client library to provide consistent features across platforms.

So you take your existing terminal application, add the version switch TerminalDirectToEmulator (or the dub subconfiguration arsd-official:terminal "builtin_emulator") and recompile. It is now a gui application.

a program running with the embedded terminal emulator displaying its own source code and demoing an inline image

That screenshot is on my custom Linux computer, the visual style on Windows machines is more akin to the standard theme (it uses OS native menus and scrollbars and a different font).

It isn't exactly progressive enhancement, since it is a compile-time switch to use this or not rather than a runtime decision based on environment, but it is close.

As the screenshot showed, all advanced features terminal.d supports, including inline images and others, are now guaranteed to be available, as well as the basics (a program that branches for pipes, for example, will still work the same way, and text output in the window works like normal), and there's potential to start easing in full gui features like menus. (though the current version doesn't expose customization of that yet).

You can also dictate your own colors and font btw.

The embedded terminal emulator presents a UI basically similar to normal terminal/console features, so you won't feel like you are losing too much compared to the native experience - though in some cases you still may be! You can scroll through output history in linear mode (in cellular mode, though, it assumes your program is full screen and does not allow scrolling), do mouse selection and copying (unless your application requested mouse input events, in which case the user needs to hold the shift key to override your program), and use the right-click and menubar options for the same.

The default options under the History menu a this time are Save, Filter, Clear, and Exit. Save saves the linear output history to a plain text file. (A html output may be coming later that can preserve colors and images too). Filter asks for a filter string then pops open a new window that displays only lines that match it. Clear clears the history, and exit closes the window (and this signals the terminal.d user code to exit as well - though note it does NOT forcibly kill the program, it just sets the "hanged up" flag for the event loop to process when it gets back there.)

Nothing terribly special, but the basic functions I expect from a terminal in a reasonably lightweight package.