MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / csi_dispatch

Method csi_dispatch

src/graphics/vga/mod.rs:465–673  ·  view source on GitHub ↗

CSI dispatch

(&mut self, params: &Params, _: &[u8], _: bool, c: char)

Source from the content-addressed store, hash-verified

463{
464 // CSI dispatch
465 fn csi_dispatch(&mut self, params: &Params, _: &[u8], _: bool, c: char)
466 {
467 match c
468 {
469 'm' =>
470 {
471 // Foreground
472 let mut fg = FOREGROUND;
473
474 // Background
475 let mut bg = BACKGROUND;
476
477 for param in params.iter()
478 {
479 match param[0]
480 {
481 0 =>
482 {
483 fg = FOREGROUND;
484 bg = BACKGROUND;
485 },
486
487 30..=37 | 90..=97 =>
488 {
489 fg = std_color::fromansi(param[0] as u8);
490 },
491
492 40..=47 | 100..=107 =>
493 {
494 bg = std_color::fromansi((param[0] as u8) - 10);
495 },
496
497 _ => {},
498 }
499 }
500
501 self.color_set(fg, bg);
502 },
503
504 // Cursor up
505 'A' =>
506 {
507 let mut n = 1;
508 for param in params.iter()
509 {
510 n = param[0] as usize;
511 }
512
513 self.writer[1] -= n;
514 self.cur[1] -= n;
515 },
516
517 // Cursor down
518 'B' =>
519 {
520 let mut n = 1;
521 for param in params.iter()
522 {

Callers

nothing calls this directly

Calls 9

fromansiFunction · 0.85
color_setMethod · 0.80
cposMethod · 0.80
wpos_setMethod · 0.80
cpos_setMethod · 0.80
clr_screenMethod · 0.80
clr_next_rowMethod · 0.80
cur_showMethod · 0.80
cur_hideMethod · 0.80

Tested by

no test coverage detected