commit 2e64aac7eba6791ed47514d37838b0d5d9d00cf1
parent bc282da2c2bfd820f810d1e03bc829fe3928f3e5
Author: lumidify <nobody@lumidify.org>
Date: Sun, 24 Oct 2021 14:04:14 +0200
Respect theme for cursor and text selection
Diffstat:
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
@@ -48,6 +48,8 @@ LDFLAGS_LEDIT = ${LDFLAGS} `pkg-config --libs x11 xkbfile pangoxft xext` -lm
all: ${BIN}
+# FIXME: separate *_config.h so they don't make everything recompile
+
${OBJ} : ${HDR}
.c.o:
diff --git a/buffer.c b/buffer.c
@@ -214,9 +214,11 @@ ledit_buffer_set_line_selection(ledit_buffer *buffer, int line, int start_byte,
ledit_line *l = ledit_buffer_get_line(buffer, line);
if (l->text_dirty)
err_text_dirty(buffer, line);
- /* FIXME: configure color */
- PangoAttribute *attr0 = pango_attr_background_new(0, 0, 0);
- PangoAttribute *attr1 = pango_attr_foreground_new(65535, 65535, 65535);
+ /* FIXME: Are these guaranteed to be range 0-65535? */
+ XRenderColor fg = buffer->theme->text_fg.color;
+ XRenderColor bg = buffer->theme->text_bg.color;
+ PangoAttribute *attr0 = pango_attr_background_new(fg.red, fg.green, fg.blue);
+ PangoAttribute *attr1 = pango_attr_foreground_new(bg.red, bg.green, bg.blue);
attr0->start_index = start_byte;
attr0->end_index = end_byte;
attr1->start_index = start_byte;
@@ -238,8 +240,10 @@ ledit_buffer_set_line_cursor_attrs(ledit_buffer *buffer, int line, int index) {
if (l->text_dirty)
err_text_dirty(buffer, line);
if (buffer->common->mode == NORMAL) {
- PangoAttribute *attr0 = pango_attr_background_new(0, 0, 0);
- PangoAttribute *attr1 = pango_attr_foreground_new(65535, 65535, 65535);
+ XRenderColor fg = buffer->theme->text_fg.color;
+ XRenderColor bg = buffer->theme->text_bg.color;
+ PangoAttribute *attr0 = pango_attr_background_new(fg.red, fg.green, fg.blue);
+ PangoAttribute *attr1 = pango_attr_foreground_new(bg.red, bg.green, bg.blue);
attr0->start_index = index;
attr0->end_index = index + 1;
attr1->start_index = index;