tRespect theme for cursor and text selection - ledit - Text editor (WIP) | |
git clone git://lumidify.org/ledit.git (fast, but not encrypted) | |
git clone https://lumidify.org/git/ledit.git (encrypted, but very slow) | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 2e64aac7eba6791ed47514d37838b0d5d9d00cf1 | |
parent bc282da2c2bfd820f810d1e03bc829fe3928f3e5 | |
Author: lumidify <[email protected]> | |
Date: Sun, 24 Oct 2021 14:04:14 +0200 | |
Respect theme for cursor and text selection | |
Diffstat: | |
M Makefile | 2 ++ | |
M buffer.c | 14 +++++++++----- | |
2 files changed, 11 insertions(+), 5 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
t@@ -48,6 +48,8 @@ LDFLAGS_LEDIT = ${LDFLAGS} `pkg-config --libs x11 xkbfile pa… | |
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 | |
t@@ -214,9 +214,11 @@ ledit_buffer_set_line_selection(ledit_buffer *buffer, int… | |
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… | |
+ PangoAttribute *attr1 = pango_attr_foreground_new(bg.red, bg.green, bg… | |
attr0->start_index = start_byte; | |
attr0->end_index = end_byte; | |
attr1->start_index = start_byte; | |
t@@ -238,8 +240,10 @@ ledit_buffer_set_line_cursor_attrs(ledit_buffer *buffer, … | |
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… | |
+ XRenderColor fg = buffer->theme->text_fg.color; | |
+ XRenderColor bg = buffer->theme->text_bg.color; | |
+ PangoAttribute *attr0 = pango_attr_background_new(fg.red, fg.g… | |
+ PangoAttribute *attr1 = pango_attr_foreground_new(bg.red, bg.g… | |
attr0->start_index = index; | |
attr0->end_index = index + 1; | |
attr1->start_index = index; |