From 401a7a7f7111989d7dda11524b211a488483e732 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Thu, 28 Sep 2023 23:18:54 -0400 Subject: [PATCH] =?UTF-8?q?docs:=20Improve=20clarity=20in=20documentation?= =?UTF-8?q?=20for=20`Frame`=20and=20`Terminal`=20=F0=9F=93=9A=20(#545)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/terminal.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/terminal.rs b/src/terminal.rs index a8e01df27..74df4aa51 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -91,9 +91,11 @@ pub struct TerminalOptions { /// terminal libraries: [Crossterm], [Termion] and [Termwiz]. See the [`backend`] module for more /// information. /// -/// The terminal has two buffers that are used to draw the application. The first buffer is the -/// current buffer and the second buffer is the previous buffer. The two buffers are compared at -/// the end of each draw pass to output only the changes to the terminal. +/// The `Terminal` struct maintains two buffers: the current and the previous. +/// When the widgets are drawn, the changes are accumulated in the current buffer. +/// At the end of each draw pass, the two buffers are compared, and only the changes +/// between these buffers are written to the terminal, avoiding any redundant operations. +/// After flushing these changes, the buffers are swapped to prepare for the next draw cycle./ /// /// The terminal also has a viewport which is the area of the terminal that is currently visible to /// the user. It can be either fullscreen, inline or fixed. See [`Viewport`] for more information. @@ -546,10 +548,9 @@ fn compute_inline_size( /// This is obtained via the closure argument of [`Terminal::draw`]. It is used to render widgets /// to the terminal and control the cursor position. /// -/// The changes drawn to the frame are not immediately applied to the terminal. They are only -/// applied after the closure returns. This allows for widgets to be drawn in any order. The -/// changes are then compared to the previous frame and only the necessary updates are applied to -/// the terminal. +/// The changes drawn to the frame are applied only to the current buffer. +/// After the closure returns, the current buffer is compared to the previous +/// buffer and only the changes are applied to the terminal. /// /// The [`Frame`] is generic over a [`Backend`] implementation which is used to interface with the /// underlying terminal library. The [`Backend`] trait is implemented for three popular Rust