From 973c30eb50f720d02c63ffa1f23f44d801eb79d1 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Wed, 2 May 2018 20:49:32 +0200 Subject: [PATCH] Add documentation for `len` field on `Storage` Because the purpose of the `len` field wasn't obvious and collided with other uses (like Vec::len()), some additional documentation has added to make things a little easier to understand. --- src/grid/storage.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/grid/storage.rs b/src/grid/storage.rs index 1f71b5b5..f59b01b7 100644 --- a/src/grid/storage.rs +++ b/src/grid/storage.rs @@ -20,6 +20,13 @@ pub struct Storage { inner: Vec, zero: usize, visible_lines: Line, + + /// Total number of lines currently active in the terminal (scrollback + visible) + /// + /// Shrinking this length allows reducing the number of lines in the scrollback buffer without + /// having to truncate the raw `inner` buffer. + /// As long as `len` is bigger than `inner`, it is also possible to grow the scrollback buffer + /// without any additional insertions. #[serde(skip)] len: usize, }