Module screen_buffer

Module screen_buffer 

Source
Expand description

This module contains the code needed for the implementation of a stateful buffer that holds a history of the lines/data received from the serial connection and the rendering/updating of the buffer to the terminal screen (stdout).

Simply writing the data received from the serial connection directly to stdout creates one main issue: there is no history of previous lines that were received from the serial connection. Without a screen buffer, lines would simply be wiped from existence as they exit the terminal’s screen.

As a result, there would be no way to implement features like scrolling, highlighting text (for UI purposes), and getting characters at specific locations within the screen for things like copying to a clipboard.

The screen buffer solves these issues by storing each line received from the connection in a VecDeque. It is important to note that currently, the capacity of the VecDeque is hardcoded with a value of 10,000 lines and is theoretically allowed to grow forever; limited by memory.

Structs§

BufferStats
ScreenBuffer
The ScreenBuffer holds rendering state for the entire terminal’s window/frame. It mainly serves to allow for user-interactions that require a history and location of the data displayed within the terminal i.e. copy/paste, scrolling, & highlighting.

Enums§

UICommand
UICommand is used for communication between stdin and the ScreenBuffer.