File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -58,10 +58,12 @@ STATIC char *str_dup_maybe(const char *str) {
58
58
return s2 ;
59
59
}
60
60
61
- STATIC int count_cont_bytes (char * start , char * end ) {
61
+ STATIC size_t count_cont_bytes (char * start , char * end ) {
62
62
int count = 0 ;
63
63
for (char * pos = start ; pos < end ; pos ++ ) {
64
- count += UTF8_IS_CONT (* pos );
64
+ if (UTF8_IS_CONT (* pos )) {
65
+ count ++ ;
66
+ }
65
67
}
66
68
return count ;
67
69
}
@@ -108,7 +110,7 @@ typedef struct _readline_t {
108
110
STATIC readline_t rl ;
109
111
110
112
int readline_process_char (int c ) {
111
- size_t last_line_len = rl .line -> len ;
113
+ size_t last_line_len = utf8_charlen (( byte * ) rl .line -> buf , rl . line -> len ) ;
112
114
int cont_chars = 0 ;
113
115
int redraw_step_back = 0 ;
114
116
bool redraw_from_cursor = false;
@@ -380,7 +382,7 @@ int readline_process_char(int c) {
380
382
rl .cursor_pos -= redraw_step_back ;
381
383
}
382
384
if (redraw_from_cursor ) {
383
- if (rl .line -> len < last_line_len ) {
385
+ if (utf8_charlen (( byte * ) rl .line -> buf , rl . line -> len ) < last_line_len ) {
384
386
// erase old chars
385
387
mp_hal_erase_line_from_cursor (last_line_len - rl .cursor_pos );
386
388
}
You can’t perform that action at this time.
0 commit comments