Coverage Report

Created: 2026-10-28 07:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/console-0.16.4/src/common_term.rs
Line
Count
Source
1
use std::io;
2
3
use crate::term::Term;
4
5
0
pub(crate) fn move_cursor_down(out: &Term, n: usize) -> io::Result<()> {
6
0
    if n > 0 {
7
0
        out.write_str(&format!("\x1b[{n}B"))
8
    } else {
9
0
        Ok(())
10
    }
11
0
}
12
13
0
pub(crate) fn move_cursor_up(out: &Term, n: usize) -> io::Result<()> {
14
0
    if n > 0 {
15
0
        out.write_str(&format!("\x1b[{n}A"))
16
    } else {
17
0
        Ok(())
18
    }
19
0
}
20
0
pub(crate) fn move_cursor_left(out: &Term, n: usize) -> io::Result<()> {
21
0
    if n > 0 {
22
0
        out.write_str(&format!("\x1b[{n}D"))
23
    } else {
24
0
        Ok(())
25
    }
26
0
}
27
28
0
pub(crate) fn move_cursor_right(out: &Term, n: usize) -> io::Result<()> {
29
0
    if n > 0 {
30
0
        out.write_str(&format!("\x1b[{n}C"))
31
    } else {
32
0
        Ok(())
33
    }
34
0
}
35
36
#[inline]
37
0
pub(crate) fn move_cursor_to(out: &Term, x: usize, y: usize) -> io::Result<()> {
38
0
    out.write_str(&format!("\x1B[{};{}H", y + 1, x + 1))
39
0
}
40
41
0
pub(crate) fn clear_chars(out: &Term, n: usize) -> io::Result<()> {
42
0
    if n > 0 {
43
0
        out.write_str(&format!("\x1b[{n}D\x1b[0K"))
44
    } else {
45
0
        Ok(())
46
    }
47
0
}
48
49
#[inline]
50
0
pub(crate) fn clear_line(out: &Term) -> io::Result<()> {
51
0
    out.write_str("\r\x1b[2K")
52
0
}
Unexecuted instantiation: console::common_term::clear_line
Unexecuted instantiation: console::common_term::clear_line
53
54
#[inline]
55
0
pub(crate) fn clear_screen(out: &Term) -> io::Result<()> {
56
0
    out.write_str("\r\x1b[2J\r\x1b[H")
57
0
}
58
59
#[inline]
60
0
pub(crate) fn clear_to_end_of_screen(out: &Term) -> io::Result<()> {
61
0
    out.write_str("\r\x1b[0J")
62
0
}
63
64
#[inline]
65
0
pub(crate) fn show_cursor(out: &Term) -> io::Result<()> {
66
0
    out.write_str("\x1b[?25h")
67
0
}
68
69
#[inline]
70
0
pub(crate) fn hide_cursor(out: &Term) -> io::Result<()> {
71
0
    out.write_str("\x1b[?25l")
72
0
}