Everything you ever wanted to know about terminals(but were afraid to ask)

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

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • bash-timestamping-sqlite

    bash commandline timestamping using a sqlite database for personal analytics, activity logging and auditing

  • It should be a super simple feature to add to your terminal emulator: SCP works with a X,Y position. RCP just "jumps" there.

    If you keep an accounting of how many lines you have displayed since then, you could alter the response to RCP by also doing the appropriate amount of scrolling: it should only take one variable, the deltaY to scroll.

    If you want to test the idea, I think you could even use tmux and send commands to control the scrollback cf ahttps://superuser.com/questions/209437/how-do-i-scroll-in-tm...

    I've used similar tricks with RCP/SCP but for simpler things: the only slight difficulty is the deltaY accounting, like when you are executing commands near the bottom of the screen because you must take into account that scolling will happen - but it's essentially similar to your idea.

    So check https://github.com/csdvrx/bash-timestamping-sqlite/blob/main... and make sure you understand both how the __notbottom function works, and why PS0 needs an extra Esc[2a

    Actually, now that I think more about your idea, it would be sweet to keep a SCP/RCP stack with multiple values, where you can push values with each SCP then pop them with RCP, say in sequence, or maybe just access the nth value with a different command that wouldn't pop them? That could be done nicely by augmenting RCP.

    Also you could augment SCP with an optional flag to specify whether the terminal should scroll back upon RCP of this nth entry, and you'd have a great function that would be quite useful (ex: SCP with a jump bool when the return is non 0: you could make a shortcut to jump to the commands that have returned errors)

    There's no reason to stop adding cool features to terminals: we're in a terminal renaissance!

  • Windows Terminal

    The new Windows Terminal and the original Windows console host, all in the same place!

  • > Is that correct?

    It's not exactly like that - it's more like there are competing "standards" and interpretations of these standards, and sometimes supporting one means not supporting the other.

    Fortunately, such things are rare, and can be addressed by GUI options.

    Take for example SGR1 for "bold/intense" text: read the whole issue that came to Microsoft Terminal team in 2018 up to its most recent discussions on https://github.com/microsoft/terminal/issues/109 then check the "simpler" version in wikipedia https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_.28Select... and you will realize there's no "right" answer between bold and bright (or both!), just different preferences and interpretations of the standards.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • cosmopolitan

    build-once run-anywhere c library

  • Here's the reference I use for VT100 ANSI control sequences: https://github.com/jart/cosmopolitan/blob/c6bbca55e9f977e386... I created this reference because there wasn't one available before that could be easily copy/pasted into GNU C or Python string literals.

  • termfo

    A terminfo library for Go

  • > From the tone of this piece I gather that the ANSI escape codes are actually standard enough to target.

    termfo[1] comes with a "termfo" CLI utility which groups terminals by escape code; for example "termfo find-cap save_cursor" shows that almost all terminals use "\x1b7", with just a few very old ones using something different (full output is a bit long, but it's at [2]).

    It's useful to check "can I safely hard-code this escape code?" But like you said: for ANSI it's pretty safe to just hard-code most codes, especially the common ones, but never hurts to check.

    [1]: https://github.com/arp242/termfo

    [2]: https://pastebin.com/raw/pVHGR6aZ

  • winprint

    winprint 2.0 - Advanced source code and text file printing. The perfect tool for printing source code, web pages, reports generated by legacy systems, documentation, or any text or HTML file. It works interactively or from the command line making it great for single users or whole enterprises. Works great with Powershell.

  • I built a cross platform app to print 'pretty formatted' source code [1]. I didn't want to re-invent the wheel on formatting source code, so looked at all the existing libraries. Originally I figured formatting to HTML, and then building a print-friendly HTML render would work. But this proved super challenging. I tried a dozen HTML engines (including Chromium) but none gave me enough control to render just a single page of the original source file.

    Then I noticed Pygments, a Python-based library for pretty formatting source code, has an option to output an ANSI formatted file. I quickly found a bunch of libraries that could render ANSI formatted text to a print canvas.

    In the end, I put the original source code file through 'pygmentize -16m -o tempfile.an` (`16m` is the 16M color terminal ANSI formatter) and pipe the `tempfile.an` through a print-optimized renderer to actually print the source code.

    ANSI escapes FTW!

    [1] WinPrint - https://github.com/tig/winprint

    For a second after I read the title, before I saw the domain, I thought that Linus had written a followup article to his original -- very popular on HN -- one.

    https://hn.algolia.com/?query=The%20TTY%20demystified&sort=b...

  • blessed

    Blessed is an easy, practical library for making python terminal apps (by jquast)

  • If this piques your interest and you use Python, check out the blessed library: https://github.com/jquast/blessed

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • derasterize

    textmode supremacy

  • She's not only done work with sixels but she's the maintainer of the highest quality tool for rendering images as unicode blocks. https://github.com/csdvrx/derasterize

  • murex

    A smarter shell and scripting environment with advanced features designed for usability, safety and productivity (eg smarter DevOps tooling)

  • libapps

    Fork of https://chromium.googlesource.com/apps/libapps/

  • Upstream: https://chromium.googlesource.com/apps/libapps/+/HEAD/hterm

    Fork used by iSH: https://github.com/ish-app/libapps/tree/master/hterm

    I looked at the docs (https://github.com/ish-app/libapps/blob/master/hterm/doc/Con...) and it appears to use the same protocol as iTerm.

    Here's an implementation: https://github.com/ish-app/libapps/blob/master/hterm/etc/hte...

  • Gui.cs

    Cross Platform Terminal UI toolkit for .NET

  • While we're piling on the TUI renaissance, check out Terminal.Gui, a cross-platform library that makes building great terminal UI's easy:

    https://github.com/migueldeicaza/gui.cs

    (Disclaimer, I maintain Terminal.gui).

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