Update roll-up on my arsd libraries

H. S. Teoh via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Apr 13 11:11:10 PDT 2017


On Thu, Apr 13, 2017 at 04:04:18PM +0000, Adam D. Ruppe via Digitalmars-d-announce wrote:
[...]
> * terminal.d is a terminal client library, similar to ncurses. It
> allows you to move the cursor around the terminal, go to full screen
> mode, output color, input all keys and mouse events.

I've been using terminal.d for a lot of my projects.  It's a really nice
terminal library that has a much better (IMO) API than the crawling mess
that is ncurses. Thanks so much for sharing it!


> In recent months, it has gained 24-bit color output support (with
> automatic approximation to lower color fallback), though I generally
> suggest you keep to 8 color output for best results in terminal
> programs.

Hooray!  Finally!  Maybe now I can play videos over SSH (albeit
ultra-pixelated). :-P


> It also got a `getline` function with user editing and autocompletion
> available, unified some of the key input events, and a
> ScrollbackBuffer which is clunky to use, but allows you to have
> individual scroll buffers scattered around the screen.

Very nice. So far I've been rolling my own for user input, but it's nice
to have built-in support.

And on that note, I've been playing around with my own range-like
abstractions over Terminal (variously called Display or Canvas), that
lets you treat rectangular subsets of the Terminal as sub-terminals in
their own right (as least as far as output is concerned).  Basically,
there's an isCanvas template that acknowledges anything that has moveTo
and writef as a canvas-like type (and obviously designed so that
Terminal automatically qualifies), along with a series of introspection
templates to identify if a canvas has a clear method, a flush method,
etc.. On top of this there's a subcanvas UFCS function that lets you
create arbitrary rectangular views over any canvas (with automatic
moveTo coordinate translations, etc.).  So I can write code that will
work either directly with a Terminal, or any other Terminal-like
backends as well as arbitrary rectangular subregions.


[...]
> * simpledisplay.d has gotten a LOT of work lately.

I've been eyeing SDL (via Derelict) recently... but maybe if
simpledisplay.d does what I need, I might just use it instead.  Leaner
and meaner is always better, I think!


[...]
>   - simpledisplay.d can now survive an X server disconnect, and can
>   even migrate windows from one X server to another! Think GNU Screen
>   for GUI apps.

Now *this* really caught my eye.  I'm gonna hafta check it out just for
this feature alone.  It has always annoyed me that although such a thing
has always been *possible* for a network-oriented GUI protocol like X11,
hardly any programs (if at all!) are written in a way that would work
this way.  This is a really awesome feature and now I'm *really* tempted
to try it out!


[...]
> I haven't used SDL or anything similar for years thanks to
> simpledisplay.d.  Its only dependency is color.d, leading to simple
> builds.

Now I'm very tempted to look into simpledisplay.d instead of SDL.


> * And the huge one in the last month, minigui.d is a small GUI widget
> library that aims to use native widgets on Windows and a small set of
> custom ones on Linux (in the future, it might also support GTK
> widgets, though I don't plan to write that myself, there is just
> another user who said he might). It has no dependencies except for
> simpledisplay.d and color.d and the operating system - no complicated
> library build process, no huge dlls to distribute with your program.

Awesome!!!  I always hated those bulky toolkit libraries that includes
everything and the kitchen sink -- 90% of which you don't actually need
in your application, which usually means you have a ton of dependencies
that aren't actually necessary and library dependency hell when you ship
your binaries.


[...]
> It automatically sizes and lays out your widgets and has an event
> system similar to Javascript. With add on modules like minigui_xml,
> you can create windows from XML definitions, and it is script.d
> compatible. When I'm ready, I'll post that too, and hopefully you can
> take basic web knowledge over to desktop land... without just
> embedding browsers and calling them desktop apps. My largest program
> is about 800 KB, and that's all it needs.

That's cool, man.  Now I gotta check this out too! :-P


> Since it is built on simpledisplay, it also gets X connection
> disconnect survival or migration!

This is a killer feature, IMO.


[...]
> I'll write more about minigui.d and do a separate announcement for it
> when it reaches version 1.0, which will probably be in about another
> month.

Awesome!


[...]
> Look forward to more on this, it is close to being ready for general
> use, and then we'll have another chapter in the D gui ecosystem.
> dlangui <https://github.com/buggins/dlangui>, I hope you like some
> friendly competition :)

This looks like a potential awesome trend, especially that bit about X
server disconnection survival / migration.  I think we could write a
killer app on top of this.  Say a terminal that travels with you
wherever you go -- migratable from desktop to laptop on wifi and back,
perhaps even to/from your {smart/dumb}phone or tablet, so don't have to
bother with reconnecting your current code hacking session, but can just
pick up and keep going from where you left off instantaneously.

Or a lightweight mini-browser that follows you wherever you go. Etc.

We could start a new trend based on migratable apps that can move around
from device to device seamlessly. Sure, browser apps have this to some
extent, but we're talking about not even needing to start your browser
and relogin and all that jazz -- just resume in exactly the same state
you left it on the previous device.  Or ping-pong a terminal window
between you and a colleague for instantaneous collaboration.  Best of
all, the programmers only need to put in minimal effort to support it.


T

-- 
VI = Visual Irritation


More information about the Digitalmars-d-announce mailing list