Write Your Own Terminal

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. bubbleos

    nice! probably magenta on a red background is undesirable, though; maybe switch to colors with better contrasts

    i hate x11 visuals and in https://gitlab.com/kragen/bubbleos/blob/master/yeso/yeso-xli... i just assume that everything is 32-bit bgra. i need to get around to fixing that at some point

    what do you think an idiomatic ruby binding for yeso would look like? so far i only have lua, c, and python bindings. my ruby experience is both limited (only a few thousand lines of code) and over a decade ago

  2. CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  3. crt

    Minimal terminal emulator for Bubbletea. (by BigJk)

    I wrote a small terminal emulator a while ago to have a portable terminal for my terminal based game. It's very specific but I had great fun with it.

    https://github.com/bigjk/crt

  4. Mosh

    Mobile Shell

    FWIW, I wouldn't try to parse escape sequences "directly" from the input bytestream -- it's easy to end up with annoying bugs. Longer-term it's probably better to separate the logic e.g.:

    - First step (for a UTF-8-input terminal emulator) means "lexing" the input bytestream as UTF-8 into a stream of USVs, which involves some subtleties (https://github.com/mobile-shell/mosh/blob/master/src/termina...).

    - Second step is to run the DEC parser/FSM logic on the sequence of USVs, which is independent of the escape sequences (https://vt100.net/emu/dec_ansi_parser ; https://github.com/mobile-shell/mosh/blob/master/src/termina...).

    - And then the third step is for the terminal to execute the "dispatch"/"execute"/etc. actions coming from the FSM, which is where the escape sequences and control chars get implemented (https://github.com/mobile-shell/mosh/blob/master/src/termina...).

    Without this separation, it's easier to end up with bugs where, e.g., a UTF-8 sequence or an ANSI escape sequence is treated differently when it's split between multiple read() calls vs. all in one call.

  5. endbasic

    BASIC environment with a REPL, a web interface, a graphical console, and RPi support written in Rust

    I can confirm that writing a terminal is fun, for the reasons mentioned in the article: it’s easy to get “self-hosting”, but then the possibilities are endless :)

    In my case, this was about creating the terminal for EndBASIC (https://www.endbasic.dev/). I wanted to mix text and graphics in the same console, so I had to ditch Xterm.js and create my own thing. It was really exciting to see graphics rendering mix with text “just fine” when I was able to render the first line.

  6. rubyterm

    Tiny ruby terminal for X11

    No current version, but I'm preparing it. But actually, to see a really ridiculously minimalist start, this was my starting point, which used a tiny X extension to do the X rendering (though it optimistically included a dummy class intended to be the start for the Ruby X backend). It's awfully limited, and awfully broken, but it shows how little it takes to be able to start writing:

    https://github.com/vidarh/rubyterm

    It's totally useless for anything other that testing or expanding on, but it was the starting point for the terminal I now run every day, and I'll be updating that repo as I clean up my current version at some point.

    The current version uses this for a pure Ruby (no Xlib) X11 client implementation:

    https://github.com/vidarh/ruby-x11

    And this pure-Ruby TrueType font renderer (I did the Ruby conversion; the C code it's based on was not mine, and is a beautiful example of compact C - look up libschrift):

    https://github.com/vidarh/skrift

  7. ruby-x11

    Pure Ruby implementation of the X Window System Protocol

    No current version, but I'm preparing it. But actually, to see a really ridiculously minimalist start, this was my starting point, which used a tiny X extension to do the X rendering (though it optimistically included a dummy class intended to be the start for the Ruby X backend). It's awfully limited, and awfully broken, but it shows how little it takes to be able to start writing:

    https://github.com/vidarh/rubyterm

    It's totally useless for anything other that testing or expanding on, but it was the starting point for the terminal I now run every day, and I'll be updating that repo as I clean up my current version at some point.

    The current version uses this for a pure Ruby (no Xlib) X11 client implementation:

    https://github.com/vidarh/ruby-x11

    And this pure-Ruby TrueType font renderer (I did the Ruby conversion; the C code it's based on was not mine, and is a beautiful example of compact C - look up libschrift):

    https://github.com/vidarh/skrift

  8. skrift

    A pure Ruby conversion (*not* wrapper) of the libschrift TrueType font renderer

    No current version, but I'm preparing it. But actually, to see a really ridiculously minimalist start, this was my starting point, which used a tiny X extension to do the X rendering (though it optimistically included a dummy class intended to be the start for the Ruby X backend). It's awfully limited, and awfully broken, but it shows how little it takes to be able to start writing:

    https://github.com/vidarh/rubyterm

    It's totally useless for anything other that testing or expanding on, but it was the starting point for the terminal I now run every day, and I'll be updating that repo as I clean up my current version at some point.

    The current version uses this for a pure Ruby (no Xlib) X11 client implementation:

    https://github.com/vidarh/ruby-x11

    And this pure-Ruby TrueType font renderer (I did the Ruby conversion; the C code it's based on was not mine, and is a beautiful example of compact C - look up libschrift):

    https://github.com/vidarh/skrift

  9. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  10. skrift-x11

    Pure X11 integration for the pure Ruby "Skrift" TrueType engine

    I really should just reproduce that output in its entirety for direct comparison.

    If it does not produce pixel for pixel identical output it's a bug. But here is the first pass of code that uses the same approach to integrate it with X and use Xrender to output the rendered glyphs:

    https://github.com/vidarh/skrift-x11

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • A 2D shoot 'em up game made with Ebitengine https://github.com/m110/airplanes

    2 projects | /r/gogamedev | 3 Dec 2023
  • Did Reddit just denylist all IPs?

    2 projects | news.ycombinator.com | 14 Nov 2023
  • Ask HN: Whats the modern day equivalent of 80s computer for kids to explore?

    6 projects | news.ycombinator.com | 1 Oct 2023
  • EndBASIC

    3 projects | news.ycombinator.com | 13 Sep 2023
  • Does this exist already? A converter from MS BASIC to Rust

    2 projects | /r/rust | 14 Jun 2023

Did you know that Ruby is
the 12th most popular programming language
based on number of references?