Live data from Hacker News

Show HN: A pure-Ruby X11 terminal

github.com

1–10 of 12 posts

Show HN: A pure-Ruby X11 terminal

#1
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).

Show HN: A pure-Ruby X11 terminal
github.com

Re: Show HN: A pure-Ruby X11 terminal

#3
> This shows Rubyterm running on my Ruby based WM, running Rubyterm with a text-based-backend that renders a a terminal to text (so it can run in any terminal), running my editor Re editing the Rubyterm example. The text is rendered using the pure-Ruby TrueType font renderer Skrift, and connected to my X11 server using the Pure-X11 Ruby X11 bindings

Cool

Re: Show HN: A pure-Ruby X11 terminal

#5

> This shows Rubyterm running on my Ruby based WM, running Rubyterm with a text-based-backend that renders a a terminal to text (so it can run in any terminal), running my editor Re editing the Rubyterm example. The text is rendered using the pure-Ruby TrueType font renderer Skrift, and connected to my X11 server using the Pure-X11 Ruby X11 bindings Cool

Thanks. I just re-targeted my editor to use this code to render using the text-based-backend or optionally using the X11 backend, so now I can layer the same renderer even more times...

Re: Show HN: A pure-Ruby X11 terminal

#6
post #4

I just connected the dots. You're the guy who constructed a direct Ruby-to-assembly compiler some time ago, right?

Yeah, it's languished for years. I did a stint last autumn to get it to start passing more of Rubyspec, but haven't had time to take it further.

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.

Re: Show HN: A pure-Ruby X11 terminal

#8
post #2

> Why? Because I can. Always the best reason.

I find I have to specify this for some of these projects, because rewriting basic stuff like this often has a lot of people asking what the point is...

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...

Re: Show HN: A pure-Ruby X11 terminal

#9
post #7

https://en.wikipedia.org/wiki/Terminal_emulator , not https://en.wikipedia.org/wiki/X_terminal

Languages evolve. Nobody I know goes around bothering saying "terminal emulator". The last time I touched an X terminal was 30 years ago - I have no intention of bothering with the distinction.
Post reply on HN