• Stars
    star
    481
  • Rank 91,384 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A TUI text reader for the terminal.

Fltrdr

A TUI text reader for the terminal.

fltrdr

Click the above gif to view a video of Fltrdr in action.

Contents

About

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 by ignoring all newline characters and removing sequential whitespace. Its purpose is to facilitate reading, scanning, and searching 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. It can be used to read text from either a file or stdin.

Features

  • word-based text reader
  • vi inspired key-bindings
  • read UTF-8 encoded text from a file or stdin
  • play mode with variable speed controlled through WPM
  • in play mode, longer pauses occur on words that end in punctuation
  • focus point to align the current word
  • focus point tries to be smart about its placement, ignoring any surrounding punctuation or plurality
  • search forwards and backwards using regular expressions
  • command prompt to interact with the program
  • store your settings in a configuration file
  • choose how many words are shown at a time
  • colours can be customized
  • chars/symbols can be customized
  • show/hide parts of the interface
  • mouse support for play/pause and scrolling text
  • history file for command prompt inputs
  • history file for search prompt inputs
  • fuzzy search prompt input history based on current prompt input
  • load and save reader state to continue where you last left off

Usage

View the usage and help output with the --help or -h flag. The help output contains the documentation for the key bindings and commands for customization.

Terminal Compatibility

This program uses raw terminal control sequences to manipulate the terminal, such as moving the cursor, styling the output text, and clearing the screen. Although some of the control sequences used may not work as intended on all terminals, they should work fine on any modern terminal emulator.

Pre-Build

This section describes what environments this program may run on, any prior requirements or dependencies needed, and any third party libraries used.

Important

Any shell commands using relative paths are expected to be executed in the root directory of this repository.

Dependencies

  • C++17 compiler/library
  • CMake >= 3.8
  • ICU >= 62.1
  • OpenSSL >= 1.1.0

Linked Libraries

  • stdc++fs (libstdc++fs) included in the C++17 Standard Library
  • crypto (libcrypto) part of the OpenSSL Library
  • icuuc (libicuuc) part of the ICU library
  • icui18n (libicui18n) part of the ICU library

Included Libraries

  • parg: for parsing CLI args, included as ./src/ob/parg.hh

Environment

  • Linux (supported)
  • BSD (supported)
  • macOS (supported)

macOS

Using a new version of gcc or llvm is required, as the default Apple llvm compiler does not support C++17 Standard Library features such as std::filesystem.

A new compiler can be installed through a third-party package manager such as Brew. Assuming you have Brew already installed, the following commands should install the latest gcc.

brew install gcc
brew link gcc

The following line will then need to be appended to the CMakeLists.txt file. Replace the placeholder <path-to-g++> with the canonical path to the new g++ compiler binary.

set (CMAKE_CXX_COMPILER <path-to-g++>)

Build

The following shell command will build the project in release mode:

./build.sh

To build in debug mode, run the script with the --debug flag.

Install

The following shell command will install the project in release mode:

./install.sh

To install in debug mode, run the script with the --debug flag.

Configuration

Base Config Directory (BASE): ${HOME}/.fltrdr
State Directory: BASE/state
History Directory: BASE/history
Config File: BASE/config
State Files: BASE/state/<content-id>
Search History File: BASE/history/search
Command History File: BASE/history/command

Use --config=<file> to override the default config file.
Use --config-base=<dir> to override the default base config directory.

The base config directory and config file must be created by the user. The config file in the base config directory must be named config. It is a plain text file that can contain any of the commands listed in the Commands section of the --help output. Each command must be on its own line. Lines that begin with the # character are treated as comments.

If you want to permanently use a different base config directory, such as ~/.config/fltrdr, add the following line to your shell profile:

alias fltrdr="fltrdr --config-base ~/.config/fltrdr"

The following shell commands will create the base config directory in the default location and copy over the example config file:

mkdir -pv ~/.fltrdr
cp -uv ./config/default ~/.fltrdr/config

Several config file examples can be found in the ./config directory.

License

This project is licensed under the MIT License.

Copyright (c) 2019 Brett Robinson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

peaclock

A responsive and customizable clock, timer, and stopwatch for the terminal.
C++
514
star
2

belle

An HTTP / Websocket library in C++17 using Boost.Beast and Boost.ASIO.
C++
102
star
3

asciimation

An ASCII animation interpreter for the terminal.
C++
102
star
4

crex

Explore, test, and check regular expressions in the terminal.
C++
55
star
5

stig

A CLI tool for searching GitHub from the terminal.
C++
39
star
6

octavia

octobanana's customizable text-based audio visualization interactive application.
C++
23
star
7

hr

A horizontal rule for the terminal.
C++
22
star
8

nyble

A snake game for the terminal.
C++
22
star
9

hexana

Display file contents in hexadecimal and ASCII.
Assembly
15
star
10

parg

A header only c++ library for parsing command line arguments and generating usage/help output.
C++
10
star
11

lssa

List similar artists.
C++
9
star
12

pine

The pine programming language.
C++
6
star
13

nansi

A CLI tool to filter ansi escape sequences and format text streams.
C++
5
star
14

gentone

Generate a tone from a note or frequency.
C++
5
star
15

euarel

A CLI tool for URL percent-encoding and percent-decoding text.
C++
5
star
16

html

A header only c++ library for creating, manipulating, and rendering html, css, and js.
C++
3
star
17

floatybox

Float your way through perilous terrain in this endless side-scroller game.
C++
3
star
18

lispp

A Lisp interpreter in C++.
C++
3
star
19

m8

A general-purpose preprocessor for metaprogramming.
C++
2
star
20

str

A small library for handling strings in c.
C
2
star
21

ireadit

A browser extension that hides the comment section of link posts on reddit and hacker news if the article has not been read.
JavaScript
2
star
22

asio-chat

A modified version of the boost asio chat client / server program.
C++
1
star
23

m8-modules

Code modules / snippets to be used with M8's 'mod' macro.
1
star
24

setcase

A cli tool to transform text to uppercase and lowercase.
C++
1
star
25

lab

Testing grounds for programs and ideas in various languages.
C++
1
star
26

tuff

A shell script to shorten Pebble SDK commands.
Shell
1
star
27

asm-case

ASCII lowercase/uppercase filter in x86-64 assembly.
Assembly
1
star