commit - 2aeddf9c1b0f33b94a01a0c307e3408b89e746c5
commit + bd644709daa2a689b354c7aa326d329f2e4adc3b
blob - e0c55ede036adf31c63125cb0bc73acbbfb83e08
blob + 0d4f8c513a1746277dbe82b4e81e8e060cda0d66
--- ui.c
+++ ui.c
restore_curs_x(struct buffer *buffer)
{
struct vline *vl;
- const char *prfx;
+ const char *prfx, *text;
vl = buffer->current_line;
if (vl == NULL || vl->line == NULL)
buffer->curs_x = buffer->cpoff = 0;
- else if (vl->parent->data != NULL)
- buffer->curs_x = utf8_snwidth(vl->parent->data+1, buffer->cpoff) + 1;
- else
+ else if (vl->parent->data != NULL) {
+ text = vl->parent->data;
+ buffer->curs_x = utf8_snwidth(text + 1, buffer->cpoff) + 1;
+ } else
buffer->curs_x = utf8_snwidth(vl->line, buffer->cpoff);
buffer->curs_x += x_offset;