diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-02 15:34:01 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-02 15:34:01 -0400 |
commit | 99b2cad147b58b424f059c1fc49d68da57cf3bfa (patch) | |
tree | c1b275ee6f248de02598f7bee018c2c6990bd30b /sys/dev/cons/cons.c | |
parent | 5874a90708a38a54264ef1fddbfdfe3ca68ebcfa (diff) |
kernel: console: Add 'show_curs' feat flag
Add 'show_curs' feat flag to enable/disable whether or not the cursor
should be drawn
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/dev/cons/cons.c')
-rw-r--r-- | sys/dev/cons/cons.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/dev/cons/cons.c b/sys/dev/cons/cons.c index 4df854c..2cef071 100644 --- a/sys/dev/cons/cons.c +++ b/sys/dev/cons/cons.c @@ -235,8 +235,14 @@ cons_handle_special(struct cons_screen *scr, char c) static void cons_draw_cursor(struct cons_screen *scr, uint32_t color) { + struct console_feat *featp; size_t idx; + featp = &scr->feat; + if (!featp->show_curs) { + color = scr->bg; + } + /* Past screen width? */ if (scr->curs_col >= scr->ncols) { scr->curs_col = 0; @@ -437,14 +443,27 @@ static int ctl_feat_write(struct ctlfs_dev *cdp, struct sio_txn *sio) { struct cons_screen *scr = &g_root_scr; - struct console_feat *featp; + struct console_feat *featp, oldfeat; featp = &scr->feat; + oldfeat = *featp; if (sio->len > sizeof(*featp)) { sio->len = sizeof(*featp); } memcpy(featp, sio->buf, sio->len); + + /* + * If we are suddenly trying to reset the cursor + * status, redraw it. + */ + if (featp->show_curs != oldfeat.show_curs) { + if (featp->show_curs == 0) { + HIDE_CURSOR(scr); + } else { + SHOW_CURSOR(scr); + } + } return sio->len; } @@ -528,6 +547,7 @@ cons_init(void) featp = &g_root_scr.feat; featp->ansi_esc = 1; + featp->show_curs = 1; g_root_scr.ch_col = 0; g_root_scr.ch_row = 0; g_root_scr.fg = CONSOLE_FG; |