diff --git a/bin/kernel.img b/bin/kernel.img index 0926ec1..e1c52ce 100755 Binary files a/bin/kernel.img and b/bin/kernel.img differ diff --git a/bin/kernel7.img b/bin/kernel7.img index 93944f1..706bcfb 100755 Binary files a/bin/kernel7.img and b/bin/kernel7.img differ diff --git a/bin/kernel8-32.img b/bin/kernel8-32.img index e58d662..7a9473f 100755 Binary files a/bin/kernel8-32.img and b/bin/kernel8-32.img differ diff --git a/bin/recovery7l.img b/bin/recovery7l.img index a7513b5..2460465 100755 Binary files a/bin/recovery7l.img and b/bin/recovery7l.img differ diff --git a/doc/terminal_codes.txt b/doc/terminal_codes.txt index 4d196c9..4235e87 100644 --- a/doc/terminal_codes.txt +++ b/doc/terminal_codes.txt @@ -1,6 +1,7 @@ Cursor Control [?25l Cursor invisible +[?25b Cursor blinking [?25h Cursor visible [H Move to 0-0 [f Move to 0-0 diff --git a/src/gfx.c b/src/gfx.c index ea0685a..e6673b2 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -123,6 +123,8 @@ typedef struct { unsigned int cursor_col; /// Current column position (0-based) unsigned int saved_cursor[2]; /// Saved cursor position char cursor_visible; /// 0 if no visible cursor + char cursor_blink; /// 0 if not blinking + unsigned int blink_timer_hnd; /// timer handle for cursor blink scn_state state; /// Current scan state } term; @@ -1514,6 +1516,33 @@ void gfx_term_set_cursor_visibility( unsigned char visible ) ctx.term.cursor_visible = visible; } +void gfx_term_switch_cursor_vis( __attribute__((unused)) unsigned hnd, + __attribute__((unused)) void* pParam, + __attribute__((unused)) void *pContext ) +{ + if (ctx.term.cursor_visible) + { + gfx_term_set_cursor_visibility(0); + gfx_restore_cursor_content(); + } + else + { + gfx_term_set_cursor_visibility(1); + gfx_term_render_cursor(); + } + ctx.term.blink_timer_hnd = attach_timer_handler(2, &gfx_term_switch_cursor_vis, 0, 0); +} + +void gfx_term_set_cursor_blinking( unsigned char blink ) +{ + ctx.term.cursor_blink = blink; + remove_timer(ctx.term.blink_timer_hnd); // it's okay to be 0 + if (blink) + { + ctx.term.blink_timer_hnd = attach_timer_handler(2, &gfx_term_switch_cursor_vis, 0, 0); + } +} + void gfx_term_move_cursor( unsigned int row, unsigned int col ) { @@ -2029,8 +2058,22 @@ int state_fun_final_letter( char ch, scn_state *state ) state->cmd_params_size == 1 && state->cmd_params[0] == 25 ) { - gfx_term_set_cursor_visibility(0); - gfx_restore_cursor_content(); + gfx_term_set_cursor_blinking(0); + if (ctx.term.cursor_visible) + { + gfx_term_set_cursor_visibility(0); + gfx_restore_cursor_content(); + } + } + goto back_to_normal; + break; + + case 'b': + if( state->private_mode_char == '?' && + state->cmd_params_size == 1 && + state->cmd_params[0] == 25 ) + { + gfx_term_set_cursor_blinking(1); } goto back_to_normal; break; @@ -2040,8 +2083,12 @@ int state_fun_final_letter( char ch, scn_state *state ) state->cmd_params_size == 1 && state->cmd_params[0] == 25 ) { - gfx_term_set_cursor_visibility(1); - gfx_term_render_cursor(); + gfx_term_set_cursor_blinking(0); + if (ctx.term.cursor_visible == 0) + { + gfx_term_set_cursor_visibility(1); + gfx_term_render_cursor(); + } } goto back_to_normal; break;