diff --git a/src/winio.c b/src/winio.c index 58b027df3a25a9611b4073598cd7c09b794298fa..554697f87129180ea6871842fd1234b10300df6b 100644 --- a/src/winio.c +++ b/src/winio.c @@ -3823,6 +3823,7 @@ void display_main_list(void) * display the current cursor position next time. */ void do_cursorpos(bool constant) { + char c; size_t i = 0, cur_xpt = xplustabs() + 1; size_t cur_lenpt = strlenpt(openfile->current->data) + 1; int linepct, colpct, charpct; @@ -3831,7 +3832,10 @@ void do_cursorpos(bool constant) if (openfile->current->prev != NULL) i += get_totsize(openfile->fileage, openfile->current->prev); - i += mbstrnlen(openfile->current->data, openfile->current_x); + c = openfile->current->data[openfile->current_x]; + openfile->current->data[openfile->current_x] = '\0'; + i += mbstrlen(openfile->current->data); + openfile->current->data[openfile->current_x] = c; /* Check whether totsize is correct. If it isn't, there is a bug * somewhere. */