From bf33cc9b7c09ceb715414c8054c7a59dc148f06a Mon Sep 17 00:00:00 2001 From: Mike Grunweg Date: Sat, 30 Apr 2022 11:54:03 +0200 Subject: [PATCH] Document the current behaviour of clear_last_lines when called with a too large argument. --- src/term.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/term.rs b/src/term.rs index 350a7894..5d41a891 100644 --- a/src/term.rs +++ b/src/term.rs @@ -449,6 +449,10 @@ impl Term { /// Clear the last `n` lines before the current line. /// /// Position the cursor at the beginning of the first line that was cleared. + /// + /// **Caution.** When `n` is larger than the number of lines above the + /// current cursor, the top `n` lines are cleared --- including some lines + /// below the cursor. pub fn clear_last_lines(&self, n: usize) -> io::Result<()> { self.move_cursor_up(n)?; for _ in 0..n {