Fix text editor undo w/ 4+ byte utf8 characters

This commit is contained in:
Campbell Barton
2018-03-24 14:14:19 +01:00
parent 9d1de621e2
commit 3f9d5ea0ec

View File

@@ -1763,7 +1763,7 @@ static void txt_undo_add_charop(Text *text, int op_start, unsigned int c)
text->undo_buf[text->undo_pos] = op_start + 3; text->undo_buf[text->undo_pos] = op_start + 3;
text->undo_pos++; text->undo_pos++;
txt_undo_store_cursors(text); txt_undo_store_cur(text);
txt_undo_store_uint32(text->undo_buf, &text->undo_pos, c); txt_undo_store_uint32(text->undo_buf, &text->undo_pos, c);
text->undo_buf[text->undo_pos] = op_start + 3; text->undo_buf[text->undo_pos] = op_start + 3;
@@ -1957,7 +1957,7 @@ static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, s
unicode = BLI_str_utf8_as_unicode(utf8); unicode = BLI_str_utf8_as_unicode(utf8);
break; break;
case 4: /* 32-bit unicode symbol */ case 4: /* 32-bit unicode symbol */
unicode = txt_undo_read_uint32(undo_buf, undo_pos); unicode = txt_redo_read_uint32(undo_buf, undo_pos);
break; break;
default: default:
/* should never happen */ /* should never happen */