diff -urN mc-4.7.5.5.orig/src/editor/edit.c mc-4.7.5.5/src/editor/edit.c
old
|
new
|
|
1684 | 1684 | gunichar ch; |
1685 | 1685 | gchar *next_ch = NULL; |
1686 | 1686 | int width = 0; |
| 1687 | gchar utf8buf[6 + 1]; |
1687 | 1688 | |
1688 | 1689 | if (byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0) |
1689 | 1690 | { |
… |
… |
|
1701 | 1702 | |
1702 | 1703 | res = g_utf8_get_char_validated (str, -1); |
1703 | 1704 | |
| 1705 | if (res < 0) |
| 1706 | { |
| 1707 | /* Retry with explicit bytes to make sure it's not a buffer boundary */ |
| 1708 | int i; |
| 1709 | for (i = 0; i < 6; i++) |
| 1710 | utf8buf[i] = edit_get_byte (edit, byte_index + i); |
| 1711 | utf8buf[6] = '\0'; |
| 1712 | str = utf8buf; |
| 1713 | res = g_utf8_get_char_validated (str, -1); |
| 1714 | } |
| 1715 | |
1704 | 1716 | if (res < 0) |
1705 | 1717 | { |
1706 | 1718 | ch = *str; |