X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-terminal%2Fsubterm.c;h=93c06bea831f50a0b58d3adb83cc47c7b378fa6c;hb=378c4eed029eb37eec31e56bd82ca5df2dee1e73;hp=563cbf0823a9928689f2c2740785ad29faab63c4;hpb=cb51a41fa632790ea839aa126844dfc2d74eb341;p=elogind.git diff --git a/src/libsystemd-terminal/subterm.c b/src/libsystemd-terminal/subterm.c index 563cbf082..93c06bea8 100644 --- a/src/libsystemd-terminal/subterm.c +++ b/src/libsystemd-terminal/subterm.c @@ -286,6 +286,8 @@ static Output *output_free(Output *o) { if (!o) return NULL; + /* re-enable cursor */ + output_printf(o, "\e[?25h"); /* disable alternate screen buffer */ output_printf(o, "\e[?1049l"); output_flush(o); @@ -317,6 +319,11 @@ static int output_new(Output **out, int fd) { if (r < 0) goto error; + /* always hide cursor */ + r = output_printf(o, "\e[?25l"); + if (r < 0) + goto error; + r = output_flush(o); if (r < 0) goto error; @@ -421,10 +428,7 @@ static int output_draw_cell_fn(term_screen *screen, output_printf(o, "\e[38;2;%u;%u;%um", attr->fg.red, attr->fg.green, attr->fg.blue); break; case TERM_CCODE_BLACK ... TERM_CCODE_WHITE: - if (attr->bold) - output_printf(o, "\e[%um", attr->fg.ccode - TERM_CCODE_BLACK + 90); - else - output_printf(o, "\e[%um", attr->fg.ccode - TERM_CCODE_BLACK + 30); + output_printf(o, "\e[%um", attr->fg.ccode - TERM_CCODE_BLACK + 30); break; case TERM_CCODE_LIGHT_BLACK ... TERM_CCODE_LIGHT_WHITE: output_printf(o, "\e[%um", attr->fg.ccode - TERM_CCODE_LIGHT_BLACK + 90); @@ -475,7 +479,6 @@ static void output_draw_screen(Output *o, term_screen *s) { term_screen_draw(s, output_draw_cell_fn, o, NULL); - output_move_to(o, s->cursor_x + 1, s->cursor_y + 3); output_printf(o, "\e[m"); } @@ -539,10 +542,6 @@ static void output_draw(Output *o, bool menu, term_screen *screen) { else output_draw_screen(o, screen); - /* show cursor */ - if (!(screen->flags & TERM_FLAG_HIDE_CURSOR)) - output_printf(o, "\e[?25h"); - /* * Hack: sd-term was not written to support TTY as output-objects, thus * expects callers to use term_screen_feed_keyboard(). However, we