fix(txt): fix returned value of lv_txt_iso8859_1_next(..., NULL) (#3338)

Should return the first character of txt instead of the following one.

For example, used in lv_txt_get_width() to get 'letter_next' leading to
incorrect lv_font_get_glyph_width results.

Co-authored-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
This commit is contained in:
Arnaud Mouiche
2022-05-10 18:25:46 +02:00
committed by GitHub
parent c6c2864048
commit 6c68095fb5

View File

@@ -798,7 +798,7 @@ static uint32_t lv_txt_iso8859_1_conv_wc(uint32_t c)
*/ */
static uint32_t lv_txt_iso8859_1_next(const char * txt, uint32_t * i) static uint32_t lv_txt_iso8859_1_next(const char * txt, uint32_t * i)
{ {
if(i == NULL) return txt[1]; /*Get the next char*/ if(i == NULL) return txt[0]; /*Get the next char*/
uint8_t letter = txt[*i]; uint8_t letter = txt[*i];
(*i)++; (*i)++;