Skip to main content

Module lines

Module lines 

Source
Expand description

Text read as it stands: a row per line, in a line column.

One pass records where each line starts (LineIndex); a line is then read from a map of the file where it is shown, so only the rows a view reaches are decoded. Every line is a row, blank ones included, and each row carries its place in the file (crate::row_index::INDEX), so # numbers it as less -N does through any sort or filter. A \r\n ending is a line ending; bytes that are not UTF-8 are shown as � and counted in a note. Control characters stay in the value: the screen escapes them when it draws (crate::sanitize).

A large file shows its first rows once its first FIRST_BYTES are indexed; the rest is indexed behind them (Lines::index_more), and the frame’s height moves as it goes ([bound]).

A followed file’s lines are counted by the watcher (crate::follow), which moves the frame’s height ([bound]); the index reads on from its last whole line when a row past it is asked for.

guess says what text no format’s signature claims is: JSON, CSV or TSV only on real evidence, lines otherwise.

Structs§

LineIndex
Where each line of some bytes starts, from one pass. Read on from where it left off as the bytes grow: a last line with no newline yet is read again.
Lines
The lines of one file or several, read where they are shown.

Constants§

FILE
The columns: the file a line is from (several files only), and the line.
FIRST_BYTES
Bytes an open indexes before it shows the first rows. Past this the rest of a file is indexed in the background.
LINE
SHRANK
What a read of every line says when the file shrank as it was indexed.

Functions§

as_asked
A guess of lines turned to CSV when the user gave a delimited dialect (--delimiter, --comment, --header-rows, --skip-initial-space): they said the text is delimited, in a shape the guess does not try.
guess
What text no format’s signature claims is, from its first bytes head; whole when they are all there is, so a last line without a newline is complete. None for bytes that are not text, which a local file shows in the hex view.
guess_file
guess for the local file at path, through its compression. What is inside a compressed file is read through it only as delimited text or lines.
schema
The columns of one file’s lines, or several files’ with the file named.