Skip to content

Commit

Permalink
Fix unnnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nnh12 committed Dec 5, 2024
1 parent 2c34fff commit 075ab3e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 43 deletions.
3 changes: 0 additions & 3 deletions kernel/app_io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ path = "../../kernel/task"
[dependencies.stdio]
path = "../../libs/stdio"

#[dependencies.libterm]
#path = "../../kernel/libterm"

[dependencies.sync_block]
path = "../../kernel/sync_block"

Expand Down
6 changes: 0 additions & 6 deletions kernel/app_io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ use alloc::{format, sync::Arc};
use core2::io::{self, Error, ErrorKind, Read, Write};
use stdio::{StdioReader, StdioWriter};
use tty::{LineDiscipline, Slave};
use sync_block::MutexGuard;
use hashbrown::HashMap;

pub trait ImmutableRead: Send + Sync + 'static {
fn read(&self, buf: &mut [u8]) -> io::Result<usize>;
Expand Down Expand Up @@ -106,10 +104,6 @@ mod shared_maps {
}
}

pub fn get_my_terminal() -> MutexGuard<'static, HashMap<usize, IoStreams>> {
shared_maps::lock_stream_map()
}

/// Shells call this function to store queue stdio streams for applications. If
/// there are any existing readers/writers for the task (which should not
/// happen in normal practice), it returns the old one, otherwise returns None.
Expand Down
34 changes: 0 additions & 34 deletions kernel/libterm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,40 +449,6 @@ impl Terminal {
Ok(terminal)
}


pub fn text_editor(s: String) -> Result<Terminal, &'static str> {
let wm_ref = window_manager::WINDOW_MANAGER.get().ok_or("The window manager is not initialized")?;
let (window_width, window_height) = {
let wm = wm_ref.lock();
wm.get_screen_size()
};

let window = window::Window::new(
Coord::new(0, 0),
window_width,
window_height,
FONT_BACKGROUND_COLOR,
)?;

let area = window.area();
let text_display = TextDisplay::new(area.width(), area.height(), FONT_FOREGROUND_COLOR, FONT_BACKGROUND_COLOR)?;

let mut terminal = Terminal {
window,
scrollback_buffer: String::new(),
scroll_start_idx: 0,
is_scroll_end: true,
text_display,
cursor: Cursor::default(),
};
terminal.display_text()?;

terminal.print_to_terminal(s.clone());
Ok(terminal)
}



/// Adds a string to be printed to the terminal to the terminal scrollback buffer.
/// Note that one needs to call `refresh_display` to get things actually printed.
pub fn print_to_terminal(&mut self, s: String) {
Expand Down

0 comments on commit 075ab3e

Please sign in to comment.