summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal/subterm.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-10-03 14:42:42 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-10-03 15:57:00 +0200
commitcad8fe9a2b2ac340ef69233dd32e1bb1e45dae48 (patch)
treefbeed1b86c186faa0bf6ab18f7509fa00ecd49a3 /src/libsystemd-terminal/subterm.c
parent2ea8d19b210b62a02ebcb38f035e074dcba66426 (diff)
terminal/screen: add cursor rendering
This is the most simple way to render cursors: flip attr->inverse of the cursor cell. This causes the background and foreground colors of the cursor-cell to be inversed. Now that we render cursors ourselves, make subterm not call into the parent terminal to render cursors.
Diffstat (limited to 'src/libsystemd-terminal/subterm.c')
-rw-r--r--src/libsystemd-terminal/subterm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libsystemd-terminal/subterm.c b/src/libsystemd-terminal/subterm.c
index 563cbf0823..321cd35f52 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;
@@ -539,10 +546,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