drop_controls(
line) ->line
Drop from one line what a terminal would act on
The parser runs this on every line it reads. It is public for text that reaches a terminal without the parser, such as the pager's raw mode.
An escape sequence goes whole: a CSI to its final byte, an OSC to BEL or ST, a DCS, SOS, PM or APC to ST, any other ESC with the byte after it. The C0 bytes but the tab go, DEL goes, and the C1 controls in UTF-8 go.
Pass one line at a time. A sequence with no end takes the rest of the string, and a newline is a C0 byte, so it goes too.