Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for UTF-8 characters #33

Closed
julio-design opened this issue Feb 21, 2023 · 1 comment
Closed

Support for UTF-8 characters #33

julio-design opened this issue Feb 21, 2023 · 1 comment

Comments

@julio-design
Copy link

Is it possible to enable support for UTF-8 characters?

Also when I enter ctrl+v to show tabs and spaces, in the source code I changed the > symbol to », but it only shows . How can I fix that?

Thanks,

Julio

@kyx0r
Copy link
Owner

kyx0r commented Feb 23, 2023

Simply doing this change will give you the result you want; however, it won't work correctly if the replaced character has a different terminal width.

diff --git a/led.c b/led.c
index a5a6360..828ce8f 100644
--- a/led.c
+++ b/led.c
@@ -214,9 +214,10 @@ static char *led_bounds(int *off, char **chrs, int cterm)
 #define hid_ch2(out) \
 int pre = out->s_n; \
 sbuf_set(out, *chrs[o] == '\n' ? '\\' : '-', i - l) \
-if (ctx > 0 && *chrs[o] == '\t') \
-	out->s[out->s_n-1] = '>'; \
-else if (*chrs[o] == '\t') \
+if (ctx > 0 && *chrs[o] == '\t') { \
+	sbuf_cut(out, out->s_n-1) \
+	sbuf_str(out, "»") \
+} else if (*chrs[o] == '\t') \
 	out->s[pre] = '<'; \
 
 #define led_out(out, n) \

Kind Regards,
Kyryl

@kyx0r kyx0r closed this as completed Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants