Skip to content

Commit

Permalink
no idea what am doing
Browse files Browse the repository at this point in the history
  • Loading branch information
adamperkowski committed Oct 23, 2024
1 parent d45ea97 commit 269f258
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
21 changes: 15 additions & 6 deletions kernel/src/interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,24 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
}

KeyCode::ArrowLeft => {
// TODO #29: Limits & newlines
#[cfg(debug_assertions)]
WRITER.lock().decrement_column_position();
if unsafe { BUFFER_INDEX } > 0 {
WRITER.lock().decrement_column_position();

/* unsafe {
BUFFER_INDEX -= 1;
}
print!(" ");
WRITER.lock().decrement_column_position(); */
}
}

KeyCode::ArrowRight => {
// TODO #29: Limits & newlines
#[cfg(debug_assertions)]
WRITER.lock().increment_column_position();
let mut writer = WRITER.lock();

if writer.get_column_position() < unsafe { BUFFER_INDEX } {
writer.increment_column_position();
}
}

_ => {}
Expand Down
3 changes: 3 additions & 0 deletions kernel/src/vga_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ impl Writer {
pub fn increment_column_position(&mut self) {
self.column_position += 1;
}
pub fn get_column_position(&mut self) -> usize {
self.column_position
}
}

impl fmt::Write for Writer {
Expand Down

0 comments on commit 269f258

Please sign in to comment.