diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-09-02 15:03:33 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-09-02 15:54:50 +0100 |
commit | 42a15b157827dbd9c981416c8919ce5f5c907331 (patch) | |
tree | 31786a1a4bf6e67beced6533b9eb276f8a8ce3d8 /src/imv.c | |
parent | b8395af887ec1c3a3adfd8d56baa12caed740172 (diff) | |
download | imv-42a15b157827dbd9c981416c8919ce5f5c907331.tar.gz |
console: Use icu to provide proper UTF-8 editing
Diffstat (limited to 'src/imv.c')
-rw-r--r-- | src/imv.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -377,7 +377,7 @@ static void key_handler(struct imv *imv, const struct imv_event *event) { if (imv_console_is_active(imv->console)) { - if (imv_console_key(imv->console, event->data.keyboard.keyname)) { + if (imv_console_key(imv->console, event->data.keyboard.description)) { imv->need_redraw = true; return; } @@ -1209,8 +1209,20 @@ static void render_window(struct imv *imv) imv_canvas_fill_rectangle(imv->canvas, 0, wh - height - bottom_offset, ww, height + bottom_offset); imv_canvas_color(imv->canvas, 1, 1, 1, 1); - imv_canvas_printf(imv->canvas, 0, wh - height - bottom_offset, - ":%s\u2588", imv_console_prompt(imv->console)); + + int x = 0; + /* draw pre-cursor text */ + x += imv_canvas_printf(imv->canvas, x, wh - height - bottom_offset, + ":%.*s", + imv_console_prompt_cursor(imv->console), + imv_console_prompt(imv->console)); + /* draw the cursor */ + imv_canvas_color(imv->canvas, 1, 1, 1, 0.5); + imv_canvas_printf(imv->canvas, x, wh - height - bottom_offset, "\u2588"); + /* any any remaining text on top of the cursor */ + imv_canvas_color(imv->canvas, 1, 1, 1, 1); + imv_canvas_printf(imv->canvas, x, wh - height - bottom_offset, "%s", + imv_console_prompt(imv->console) + imv_console_prompt_cursor(imv->console)); } imv_canvas_draw(imv->canvas); |