terminal.d gets clipboard functions, ldc 1.20 out.

Posted 2020-02-17

I worked a little on terminal.d this week in between day job and house stuff.

Core D Development Statistics

In the community

Community announcements

See more at the announce forum.

What Adam is working on

I've had some crazy time lately being busy with day job stuff as well as things with health and around the house. But, I have done some work on terminal.d lately, including some (small) breaking changes and a few new features.

New features include a method for displaying inline image if you happen to be on my custom terminal emulator (and one to detect if you are), and clipboard access, again, on supported systems - which include my terminal emulator, Microsoft Windows, and certain (rare) builds of xterm. So probably not super useful to you, but it will improve the getline function a bit on Windows especially. When you press ctrl+v or shift+insert in the getline function, its default behavior is now to request a paste event. Similarly, middle click will request a paste from primary, if possible.

There's also a new function hasDefaultDarkBackground which just best guesses if the default background on the user's terminal is black. It is fairly reliable on Windows, but guesses on Linux. I may be able to improve it more in the future.

The workOnLine method now takes a pointer to the input source to enable these. You don't have to pass one for now for legacy compatibility but eventually I do want to make it required. If you subclassed it (though I don't think you ever should!) you will have to add the argument there too and forward it.

I expect these are all extremely niche - the core of terminal.d has been good for a while - but may be helpful in some cases to make slightly richer terminal programs.