draw_statuscolumn

Function draw_statuscolumn 

Source
fn draw_statuscolumn(
    current_buffer_type: &str,
    cur_lnum: &str,
    metas: impl Iterator<Item = ExtmarkMeta>,
    opts: Option<Opts>,
) -> String
Expand description

Constructs the status column string for the current line.

§Assumptions

  • metas yields at most a small number of items (typical per-line sign density is low).
  • Caller has already restricted extmarks to those relevant for the line being drawn.

§Rationale

  • Single pass selects highest severity and first git sign to avoid repeated scans.
  • Early break once an Error (rank 5) and a Git sign are both determined prevents unnecessary iteration.
  • Manual string building reduces intermediate allocation versus collecting sign fragments.

§Performance

  • Allocates once with a conservative capacity heuristic (lnum.len() + 64).
  • O(n) over metas, short-circuiting when optimal state reached.
  • Rank computation is a simple match with small constant cost.