Settings

Theme

Show HN: Fltrdr – A Vi Inspired Text Reader for the Terminal

octobanana.com

5 points by octobanana 7 years ago · 7 comments

Reader

dang 7 years ago

This looks like a dupe of https://news.ycombinator.com/item?id=19195819. Also, please don't do promotional voting and especially not booster comments in the threads! Our software picks up most of it and HN users figure it out too, and then they get mad and flag things (or worse).

  • octobananaOP 7 years ago

    The majority of the program has been redesigned and rewritten since the initial post 50 days ago, so I thought it would be alright to make another one. The Show HN rules say that 'A major overhaul is probably ok'. Would that still classify this as a dupe? Honestly, I was just excited of the progress made and what I had learned, and wanted to share/discuss it with others.

    I didn't engage in any kind of promotional voting. It's free software given away under the MIT license. I don't gain anything from other people using it.

octobananaOP 7 years ago

Hello! My name is Brett. For the past couple years I've been teaching myself how to program and engineer software, with a focus on C++ and Linux.

Lately, I've been interested in learning how text-based user interface (TUI) programs such as vi, vim, or less are implemented. I decided the best way to learn would be to build and implement my own TUI program, without relying on existing TUI frameworks/libraries. I went with the core idea of the program being a text reader, and decided to call it Fltrdr.

Fltrdr, or flat-reader, is a TUI text reader that runs in the terminal. It is flat in the sense that the reader is word-based. New line characters and sequential whitespace is stripped from the input text, leaving the reader with a stream of words. The words are then presented one or more at a time, moving one word forward at a user defined words per minute (WPM) variable speed.

For the past two months, I've continued to build upon Fltrdr, learning much along the way. It's written in C++17 and is distributed under the MIT License. I wanted to share the progress that has been made since the initial release, and some of the challenges that I've encountered along the way.

Supporting Unicode text was the most challenging feature. At the start, I knew very little about Unicode, and even less about what a code unit, code point, or grapheme cluster was. After a lot of research, I ended up gaining a decent understanding of what needed to be done to support inputting, manipulating, and rendering UTF-8 text, including full-width CJK Unified Ideographs. I ended up using parts of the ICU library to provide certain UTF-8 algorithms to build a non-memory-owning string view class, an owning-memory string class, and a non-memory-owning string view regex iterator. A majority of the program had to be rewritten to support this, all the way down to the keyboard/mouse input handler.

Another highly requested feature was the ability to save and restore where when last left off reading a piece of text, which is now implemented in the latest release. It works by taking an SHA256 hash of the content, and uses the hash as the file name. The current reader state is then dumped as regular commands into the file. These commands are the same ones that may be placed in the configuration file, or inputted into the programs command prompt. This process reuses the existing command parser. When that same content is opened again, Fltrdr will automatically check to see if a state file exists using a hash of the content, and loads the state if a matching file is found. This allows the ability to load and save the state whether the content came from a file, or stdin.

Lastly, more configuration options are available, with nearly everything being able to be customized.

I'm open to any feedback or suggestions, and I'd be happy to answer any questions!

For more details on what has changed, check out the release notes here: https://github.com/octobanana/fltrdr/releases/tag/0.3.0

It can be found here on GitHub: https://github.com/octobanana/fltrdr

It can also be found here on my personal site: https://octobanana.com/software/fltrdr

gsr0071 7 years ago

This is amazing, well done!

lilly1010 7 years ago

Very well coded and documented.

koa222 7 years ago

The best thing I have seen today!

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection