Skip to main content

Module marks

Module marks 

Source
Expand description

Pure helpers for marks (m<x> / '<x>) and previous-position swap (^X^X).

Marks are session-local: a HashMap<char, usize> owned by app::run. Previous-position is a single Option<usize> slot also owned by app::run.

Functionsยง

is_valid_mark_name
True iff c is a valid mark name (ASCII lowercase letter or ASCII digit).
jump_previous
Swap current top_line with the previous-position slot. Returns the new top_line, or None if no previous position has been recorded.
mark_jump
Jump to mark name. Returns the line number to jump to (clamped to [0, line_count-1]), or None if the mark is unknown / name is invalid / the source is empty. On a successful jump, records current top into previous_position.
mark_set
Set mark name to top_line. Silently no-ops on invalid mark names.
update_prev_position
Helper for big-jump dispatch sites: record the current top_line as the previous position before performing a discontinuous move.