Ha Ling Peak In The Clouds

Source Code Seen On The TV Series The 100

Terminal Text Reader Demo

updated: Tue 12 Feb 2019


Terminal Text Reader Demo

For the past three weeks, I've been working on a terminal text reader. Its purpose is to facilitate reading, scanning, and searching of text. The program has a play mode that moves the reader forward one word at a time, along with a configurable words per minute (WPM), setting. This allows the text to be read in a rapid serial visual presentation format (RSVP). The number of words displayed on either side of the center focused word is also configurable.

I started this project to explore and learn more about writing programs that use a text-based user interface (TUI). The main goal is to understand how common TUI functionality is implemented, such as the event loop, handling standard input, and drawing shapes and text on the screen. I plan on refactoring the functions and classes that deal with these things into a generic TUI library to utilize in other projects. After I clean up a few things, the source will be released under the MIT License on my site and GitHub.

Below is a short demo video to showcase some of the features and commands that are implemented so far.

It's written in C++17 with no external dependencies. Although it does depend on the C and C++ Standard Libraries along with a couple POSIX headers. It uses raw terminal control sequences to control the terminal, such as moving the cursor and clearing the screen. Due to it not using Ncurses, Termcap, or Terminfo, the control sequences are not as portable, but should work on any xterm compatible terminal emulator.

Some of the interface draws inspiration from programs such as vi and less. For example, the keys h, j, k, and l are used for movement commands, : brings up a command prompt, and / and ? are used for searching forwards and backwards respectively within the text.

To get more of a taste for how it works as a text reader, below is a short excerpt from Chapter 2 of Narnia - The Lion, The Witch and The Wardrobe read at 300 WPM.

Will this program make you a better, stronger, and faster reader, increasing your focus and reading comprehension? Perhaps, but I don't think I'm qualified to make those assertions. What I can say, is that I've been enjoying using it to read books, articles, and forum comments, and that it has been quite enjoyable to build these past few weeks.

Back to Top

Ha Ling Peak In The Clouds

Source Code Seen On The TV Series The 100