commit - 6d24bfb3ca185665e8a7fa4e5f88434690f4272d
commit + 1dc96d88793508394f21675b6084a3092d1c4dcf
blob - 81a4a7734f9793f8d8ad1985024d95075580c30e
blob + 1ef8e56feb87db2c086afd3f74980a17c57be5cf
--- ui.c
+++ ui.c
#include <string.h>
#include <unistd.h>
+#include <grapheme.h>
+
#include "cmd.h"
#include "defaults.h"
#include "ev.h"
start = hist_cur(ministate.hist);
line = buffer->current_line->parent->line + buffer->current_line->from;
c = line + buffer->point_offset;
- while (utf8_swidth_between(start, c) > (size_t)COLS/2) {
- start = utf8_next_cp(start);
+ while (start < c && utf8_swidth_between(start, c) > (size_t)COLS/2) {
+ start += grapheme_next_character_break_utf8(start, SIZE_MAX);
}
waddstr(echoarea, start);