Guide API
Skip to main content

history_add

Function history_add 

Source
pub fn history_add(id: u8, str: &str)
Expand description

Add str to the history channel identified by id.

Call this after the user confirms an input line (typically in the owning dialog’s close handler) so subsequent pops of the history viewer offer the entry. Each history-capable input line should use a unique, stable id (typically a small application-defined constant) so channels don’t share entries.

Operation order:

  1. Ignore empty strings.
  2. Remove any existing duplicate for this (id, str) pair.
  3. Evict globally-oldest entries until the new entry fits within the budget.
  4. Append the new entry (newest position).

§Turbo Vision heritage

Ports historyAdd (histlist.cpp); the raw block pointer + byte-offset encoding becomes a thread_local! Vec<HistRec>.