Settings

Theme

Show HN: Fltrdr – A TUI Text Reader for the Terminal

github.com

78 points by octobanana 7 years ago · 17 comments

Reader

octobananaOP 7 years ago

For the past month, I've been working on this terminal text reader project for fun. It started out as a project to learn more about how to structure and implement a text-based user interface with vi inspired features. It's written in C++17 and is released under the MIT license. I wanted to share it here in case someone may find it interesting.

Fltrdr, or flat-reader, is an interactive text reader for the terminal. It is flat in the sense that the reader is word-based. It creates a horizontal stream of words, ignoring all newline characters and reducing sequential whitespace. Its purpose is to facilitate reading, scanning, and searching text. The program also has a play mode that moves the reader forward one word at a time, along with a configurable words per minute (WPM) setting.

It is highly customizable, with a configuration file to persist your settings. The colourscheme can be changed to match your environments theme using either 24-bit, 8-bit, or 4-bit colours, depending on what your terminal supports. The characters used for the text border and progress bar can be set to a character or unicode-character of your choice. Some of the UI elements, such as the border, progress bar, and status bar can be individually shown/hidden to create a more minimalistic display.

I'm open to any feedback or suggestions!

This blog post from the other week contains videos of it in action: https://octobanana.com/blog/terminal-text-reader-demo

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

  • nmstoker 7 years ago

    Thanks for posting this.

    One bit of feedback: I think the video should be linked more prominently and from the README - I guessed that might be what it was for the description is a bit vague and abstract and "seeing is believing"

    • codetrotter 7 years ago

      Agreed, put a screenshot of the video with a play button at the top of the README and link it to the video.

      Also, make the video get to the point quicker. Open a file and start reading right away.

    • octobananaOP 7 years ago

      That's a good idea, thanks! I'll make an updated video of it and add a link to it in the README.md.

      • fouc 7 years ago

        alternatively, make an animated gif to replace the static image.

        an animated gif made from a portion of that second video on that blog post would be pretty good I think.

  • laumars 7 years ago

    Looks good.

    From a personal point of view, I don't like projects that have missing letters in the name. I find them confusing to read and harder to type (even after I've learned how to pronounce it). In fact even after using `nginx` for years, I still get stuck which letters to type if ever I interrupt my muscle memory.

    eg I'm in the terminal and I want to launch flat-reader... now which letters do I type and which do I ignore?

    If you're after something that's less keystrokes to launch then I much prefer the approach of applications like Visual Studio Code (`code`) or Sublime Text (`subl3`) that take a portion of the name. So you could have something like `flatr`.

    That all said, you're never going to please everyone when it comes to naming things to I expect (hope) you do take my thoughts here with a pinch of salt :)

    As for the reader itself; it looks like a lot of thought has gone into it. Good work there.

JdeBP 7 years ago

* It is interesting to see this written in "modern" C++.

* Those input handlers (you have three) are terrible; pattern matching is the wrong way to go about this.

* You could no doubt get more imaginative with the progress bar using block characters.

* Users will no doubt ask for the ability to suspend such a program; which, note, has to properly tear the whole UI down and set it back up again.

* Users will also no doubt want this to work properly with the full range of Unicode text; you have not accounted for differing character widths, that I can see. Note that there exist zero-width characters and double-width characters.

* vi sentence, paragraph, and section motions are of course actually {, }, (, ), [[, and ]].

Some help:

* https://unix.stackexchange.com/a/499139/5132

* https://unix.stackexchange.com/a/444270/5132

* http://jdebp.eu./Softwares/nosh/guide/commands/TERM.xml

* http://jdebp.eu./Softwares/nosh/guide/commands/TerminalCapab...

* https://github.com/jdebp/nosh/blob/master/source/ECMA48Decod...

* https://github.com/jdebp/nosh/blob/master/source/TUIInputBas...

* https://github.com/neovim/libtermkey/blob/master/driver-csi....

* https://vt100.net/emu/dec_ansi_parser

SkyMarshal 7 years ago

What does it read? Text files? Web sites? Maybe I missed it but I don’t see this mentioned on the github page.

  • octobananaOP 7 years ago

    It works best with any plain ASCII text. What I've been doing is taking PDF's and using `pdftotext` and `iconv` to convert documents into plain text. I'll add more information on this in the README.md to make it more clear what it reads.

yuchi 7 years ago

Thanks for sharing! I’ve been searching for months for an idea to try out Rust, and now I think I found it!

In case would you offend if I tried to port it?

  • octobananaOP 7 years ago

    I'd be stoked if you did, It would be interesting to see how the program would look in Rust.

kissgyorgy 7 years ago

a demo would be nice, something with https://asciinema.org or similar so we can get a feel of how it works without installing it.

lsh 7 years ago

what is a 'TUI' ?

Keyboard Shortcuts

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