summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal/term-screen.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/term-screen.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/term-screen.c')
-rw-r--r--src/libsystemd-terminal/term-screen.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsystemd-terminal/term-screen.c b/src/libsystemd-terminal/term-screen.c
index 2c881ca8b1..ccfb9a450c 100644
--- a/src/libsystemd-terminal/term-screen.c
+++ b/src/libsystemd-terminal/term-screen.c
@@ -4246,6 +4246,8 @@ int term_screen_draw(term_screen *screen,
line_age = MAX(line->age, page->age);
for (i = 0; i < page->width; ++i) {
+ term_attr attr;
+
cell = &line->cells[i];
cell_age = MAX(cell->age, line_age);
@@ -4259,11 +4261,16 @@ int term_screen_draw(term_screen *screen,
* renderers can assume ch_width is set properpy. */
cw = MAX(cell->cwidth, 1U);
+ attr = cell->attr;
+ if (i == screen->cursor_x && j == screen->cursor_y &&
+ !(screen->flags & TERM_FLAG_HIDE_CURSOR))
+ attr.inverse ^= 1;
+
r = draw_fn(screen,
userdata,
i,
j,
- &cell->attr,
+ &attr,
ch_str,
ch_n,
cw);