Skip to content

Commit 94c07af

Browse files
committed
Add more functions to SimpleTextOutput
1 parent 4f826f0 commit 94c07af

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/proto/console/text/output.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ pub struct Output {
1212
rows: &mut usize)
1313
-> Status,
1414
set_mode: extern "C" fn(this: &mut Output, mode: i32) -> Status,
15-
_pad: [usize; 4],
15+
set_attribute: usize,
16+
clear_screen: usize,
17+
set_cursor_position: usize,
18+
enable_cursor: extern "C" fn(this: &mut Output, visible: bool) -> Status,
1619
data: &'static OutputData,
1720
}
1821

1922
impl Output {
2023
/// Resets the text output device hardware.
21-
#[inline]
2224
pub fn reset(&mut self, extended: bool) -> Result<()> {
2325
(self.reset)(self, extended).into()
2426
}
2527

2628
/// Writes a string to the output device.
27-
#[inline]
2829
pub fn output_string(&mut self, string: *const u16) -> Result<()> {
2930
(self.output_string)(self, string).into()
3031
}
@@ -34,7 +35,6 @@ impl Output {
3435
///
3536
/// UEFI applications are encouraged to try to print a string even if it contains
3637
/// some unsupported characters.
37-
#[inline]
3838
pub fn test_string(&mut self, string: *const u16) -> bool {
3939
match (self.test_string)(self, string) {
4040
Status::Success => true,
@@ -44,7 +44,6 @@ impl Output {
4444

4545
/// Returns an iterator of all supported text modes.
4646
// TODO: fix the ugly lifetime parameter.
47-
#[inline]
4847
pub fn modes<'a>(&'a mut self) -> impl Iterator<Item = OutputMode> + 'a {
4948
let max = self.data.max_mode;
5049
OutputModeIter {
@@ -62,18 +61,21 @@ impl Output {
6261
}
6362

6463
/// Sets a mode as current.
65-
#[inline]
6664
pub fn set_mode(&mut self, mode: OutputMode) -> Result<()> {
6765
(self.set_mode)(self, mode.index).into()
6866
}
6967

7068
/// Returns the the current text mode.
71-
#[inline]
7269
pub fn current_mode(&self) -> Result<OutputMode> {
7370
let index = self.data.mode;
7471
let dims = self.query_mode(index)?;
7572
Ok(OutputMode { index, dims })
7673
}
74+
75+
/// Enables or disables the cursor.
76+
pub fn enable_cursor(&mut self, visible: bool) -> Result<()> {
77+
(self.enable_cursor)(self, visible).into()
78+
}
7779
}
7880

7981
/// The text mode (resolution) of the output device.

0 commit comments

Comments
 (0)