Show HN: A pure-Ruby X11 terminal
Posted by vidarh 2 days ago
I use this as my regular xterm replacement... Why? Because I can.
It's pure-Ruby down to the font-renderer, and the X11-bindings.
(I also run a Ruby WM, a Ruby editor, file manager, and more, so this is just par for the course of my descent into madness)
It supports double-width and double-height text, unicode (but double-width characters may currently be rescaled down), layering fonts, special rendering of box-drawing characters (to ensure they seamlessly scale and connect, and has reasonably complete vt-100/vt-102 emulation. The whole thing is available as a Rubygem and comes with an ANSI text backend, so you can run your terminal in your terminal. The bulk was written manually, but the last few days I had Claude write a test harness to shake out a bunch of bugs, and start refactoring and cleaning up the code base (it's still full of warts).
Comments
Comment by a96 1 day ago
Comment by vidarh 1 day ago
Comment by jsrcout 1 day ago
Always the best reason.
Comment by vidarh 1 day ago
But I love small rewrites (this is <3k lines of code for the terminal itself; the font renderer is 600-700 lines or so; the X11 bindings a bit larger) as a means to explore what is really actually needed for the things I do...
Comment by kunley 1 day ago
Comment by vidarh 1 day ago
github.com/vidarh/writing-a-compiler-in-ruby
It's self-hosting apart from the GC (which is a sore spot - I really want to rewrite the GC in Ruby too), glibc for a handful of functions and syscalls, and using gas/ld to assemble and link.
Comment by kunley 1 day ago
Kudos for your work - and I guess you've had a lot of fun as well
Comment by vidarh 1 day ago
I'd really like to find time to pick it up again and clean it up and I'm toying with dynamic workflows in Claude now and might just have it set up one to "burn down" rubyspecs, as it did fairly well last autumn at fixing things, including adding bignum and beginnings of Regexp support.
Getting from working to usable and fast, though, would be a lot of work.
Comment by porridgeraisin 1 day ago
Cool
Comment by vidarh 1 day ago
Comment by melon_tsui 1 day ago