diff options
| author | Lukas Fürmetz <fuermetz@mailbox.org> | 2017-07-28 16:05:28 +0200 |
|---|---|---|
| committer | Lukas Fürmetz <fuermetz@mailbox.org> | 2017-07-28 16:05:47 +0200 |
| commit | fa38b4adcbceee907b9377d33ec005855741b032 (patch) | |
| tree | ee21451d2d1df6756236488916a841ab360c9fa9 /vterm-module.h | |
| parent | ada2dcaf6102f5bcfa10d9e989e3375ddb2d3014 (diff) | |
Implement basic UTF-8 support
Diffstat (limited to 'vterm-module.h')
| -rw-r--r-- | vterm-module.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/vterm-module.h b/vterm-module.h index 57a2381..6fd2053 100644 --- a/vterm-module.h +++ b/vterm-module.h @@ -1,4 +1,6 @@ #include <emacs-module.h> +#include <inttypes.h> +#include <stdbool.h> #include <vterm.h> int plugin_is_GPL_compatible; @@ -9,6 +11,14 @@ struct Term { pid_t pid; }; +union Character { + uint32_t character; + char byte[4]; +}; + +static size_t codepoint_to_utf8(const uint32_t codepoint, unsigned char buffer[4]); +static bool utf8_to_codepoint(const unsigned char buffer[4], const size_t len, + uint32_t *codepoint); static void bind_function(emacs_env *env, const char *name, emacs_value Sfun); static void provide(emacs_env *env, const char *feature); static void message(emacs_env *env, char *message); @@ -31,7 +41,7 @@ static void vterm_flush_output(struct Term *term); static void term_finalize(void *term); static emacs_value Fvterm_new(emacs_env *env, ptrdiff_t nargs, emacs_value args[], void *data); -static void process_key(struct Term *term, char *key, VTermModifier modifier); +static void process_key(struct Term *term, unsigned char *key, size_t len, VTermModifier modifier); static emacs_value Fvterm_update(emacs_env *env, ptrdiff_t nargs, emacs_value args[], void *data); static emacs_value Fvterm_kill(emacs_env *env, ptrdiff_t nargs, |
