From 16481ee83d7bde7a28dc8b0d767e0e59d78eb678 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 4 Sep 2024 17:01:05 +0200 Subject: unicode support improvements / bugfixes --- fw/fe310/eos/eve/widget/selectw.c | 2 +- fw/fe310/eos/eve/widget/strw.c | 13 ++++++++----- fw/fe310/eos/eve/widget/textw.c | 14 ++++++++------ 3 files changed, 17 insertions(+), 12 deletions(-) (limited to 'fw/fe310/eos/eve/widget') diff --git a/fw/fe310/eos/eve/widget/selectw.c b/fw/fe310/eos/eve/widget/selectw.c index f5bb6e0..b11f9b6 100644 --- a/fw/fe310/eos/eve/widget/selectw.c +++ b/fw/fe310/eos/eve/widget/selectw.c @@ -15,7 +15,7 @@ #define DIVC(x,y) ((x) / (y) + ((x) % (y) != 0)) static int selectw_verify(utf8_t *option, uint16_t option_size) { - int o_len; + size_t o_len; uint16_t o_curr; int rv; diff --git a/fw/fe310/eos/eve/widget/strw.c b/fw/fe310/eos/eve/widget/strw.c index 6bddbe9..cd1f51d 100644 --- a/fw/fe310/eos/eve/widget/strw.c +++ b/fw/fe310/eos/eve/widget/strw.c @@ -29,7 +29,8 @@ void eve_strw_init(EVEStrWidget *widget, EVERect *g, EVEPage *page, EVEFont *font, utf8_t *str, uint16_t str_size) { EVEWidget *_widget = &widget->w; - int rv, str_len; + size_t str_len; + int rv; memset(widget, 0, sizeof(EVEStrWidget)); eve_widget_init(_widget, EVE_WIDGET_TYPE_STR, g, page, eve_strw_draw, eve_strw_touch, eve_strw_putc); @@ -47,7 +48,8 @@ void eve_strw_init(EVEStrWidget *widget, EVERect *g, EVEPage *page, EVEFont *fon } int eve_strw_update(EVEStrWidget *widget) { - int rv, str_len; + size_t str_len; + int rv; rv = utf8_verify(widget->str, widget->str_size, &str_len); if (rv != UTF_OK) { @@ -317,7 +319,7 @@ void eve_strw_putc(void *w, int c) { if (!cursor1->on) return; if (!cursor2->on && ((c == CH_BS) || (c == CH_DEL))) { - utf32_t uc; + ucp_t uc; str = widget->str + cursor1->ch; switch (c) { @@ -371,7 +373,8 @@ void eve_strw_putc(void *w, int c) { ins_c = utf8_enc(c, utf8_buf); ins_w = eve_font_ch_w(widget->font, c); } else if (c == CH_CTRLV) { - int rv, clipb_len = 0; + size_t clipb_len = 0; + int rv; clipb = eve_clipb_get(); if (clipb) { @@ -413,7 +416,7 @@ void eve_strw_putc(void *w, int c) { void eve_strw_cursor_set(EVEStrWidget *widget, EVEStrCursor *cursor, int16_t x) { int i; int16_t _x, _d; - utf32_t ch; + ucp_t ch; uint8_t ch_w; uint8_t ch_l; EVEWidget *_widget = &widget->w; diff --git a/fw/fe310/eos/eve/widget/textw.c b/fw/fe310/eos/eve/widget/textw.c index 4348b67..d77e245 100644 --- a/fw/fe310/eos/eve/widget/textw.c +++ b/fw/fe310/eos/eve/widget/textw.c @@ -32,7 +32,8 @@ void eve_textw_init(EVETextWidget *widget, EVERect *g, EVEPage *page, EVEFont *font, utf8_t *text, uint16_t text_size, uint16_t *line, uint16_t line_size) { EVEWidget *_widget = &widget->w; - int rv, text_len; + size_t text_len; + int rv; memset(widget, 0, sizeof(EVETextWidget)); eve_widget_init(_widget, EVE_WIDGET_TYPE_TEXT, g, page, eve_textw_draw, eve_textw_touch, eve_textw_putc); @@ -327,7 +328,7 @@ void eve_textw_putc(void *w, int c) { if (!cursor1->on) return; if (!cursor2->on && ((c == CH_BS) || (c == CH_DEL))) { - utf32_t uc; + ucp_t uc; text = widget->text + cursor1->ch; switch (c) { @@ -371,7 +372,8 @@ void eve_textw_putc(void *w, int c) { ins_c = utf8_enc(c, utf8_buf); ch_w = eve_font_ch_w(widget->font, c); } else if (c == CH_CTRLV) { - int rv, clipb_len = 0; + size_t clipb_len = 0; + int rv; clipb = eve_clipb_get(); if (clipb) { @@ -431,7 +433,7 @@ void eve_textw_putc(void *w, int c) { uint16_t eve_textw_text_update(EVETextWidget *widget, uint16_t line, int uievt) { int i; - utf32_t ch; + ucp_t ch; uint8_t ch_w; uint8_t ch_l; uint16_t word_w, line_w, line_b; @@ -495,7 +497,7 @@ uint16_t eve_textw_text_update(EVETextWidget *widget, uint16_t line, int uievt) void eve_textw_cursor_update(EVETextWidget *widget, EVETextCursor *cursor) { int i = LINE_START(widget, cursor->line); uint16_t x = 0; - utf32_t ch; + ucp_t ch; uint8_t ch_l; EVEWidget *_widget = &widget->w; @@ -512,7 +514,7 @@ void eve_textw_cursor_set(EVETextWidget *widget, EVETextCursor *cursor, uint8_t int i; int16_t _x, _d; uint16_t c_line = LINE_EMPTY; - utf32_t ch; + ucp_t ch; uint8_t ch_w; uint8_t ch_l; EVEWidget *_widget = &widget->w; -- cgit v1.2.3