Skip to content

Commit c526c5c

Browse files
committed
Document the current behaviour of clear_last_lines when called with a too large argument.
1 parent 465d9be commit c526c5c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/term.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,11 @@ impl Term {
436436

437437
/// Clear the last `n` lines before the current line.
438438
///
439-
/// This positions the cursor at the beginning of the first line
440-
/// that was cleared.
439+
/// Position the cursor at the beginning of the first line that was cleared.
440+
///
441+
/// **Caution.** When `n` is larger than the number of lines above the
442+
/// current cursor, the top `n` lines are cleared --- including some lines
443+
/// below the cursor.
441444
pub fn clear_last_lines(&self, n: usize) -> io::Result<()> {
442445
self.move_cursor_up(n)?;
443446
for _ in 0..n {

0 commit comments

Comments
 (0)