Skip to main content

Module tips

Module tips 

Source
Expand description

The startup tips the TUI shows (tix #1632).

The tips themselves live in src/templates/tips/, one TOML file per category, and are compiled into the binary with include_str! (concatenated in filename order): a shipped tix needs no files on disk, and the file a contributor edits is the file the modal shows. This module owns the parse and the lookup; the modal itself is crate::ui::tips, and the on/off setting is crate::config::Config::tips_on_startup.

A malformed embedded file is not allowed to take the session down: all falls back to no tips (and thus no modal) rather than panicking, and the embedded_tips_are_well_formed_and_plentiful test is what makes a malformed file a test failure instead of a silently empty dialog.

Structs§

Tip
One tip, flattened with the category it was declared under.

Functions§

all
Every tip, flattened in file order (categories in declaration order, and each category’s tips in order).
parse
Parse the tips file’s text into the flattened tip list.
random_index
A pseudo-random starting index below len.
random_start
random_index for the current wall clock.