diff --git a/src/editor/edit-impl.h b/src/editor/edit-impl.h
index d6bb43a..0ea7b34 100644
a
|
b
|
|
74 | 74 | |
75 | 75 | /* Configurable: log2 of the buffer size in bytes */ |
76 | 76 | #ifndef S_EDIT_BUF_SIZE |
77 | | #define S_EDIT_BUF_SIZE 16 |
| 77 | #define S_EDIT_BUF_SIZE 3 |
78 | 78 | #endif |
79 | 79 | |
80 | 80 | /* Size of the buffer */ |
… |
… |
|
88 | 88 | * This number can be increased for systems with enough physical memory. |
89 | 89 | */ |
90 | 90 | #ifndef MAXBUFF |
91 | | #define MAXBUFF 1024 |
| 91 | #define MAXBUFF 91024 |
92 | 92 | #endif |
93 | 93 | |
94 | 94 | /* Maximal length of file that can be opened */ |
diff --git a/src/editor/edit.c b/src/editor/edit.c
index 226151b..ddf96ab 100644
a
|
b
|
edit_get_utf (WEdit * edit, long byte_index, int *char_width) |
1758 | 1758 | gunichar ch; |
1759 | 1759 | gchar *next_ch = NULL; |
1760 | 1760 | int width = 0; |
| 1761 | char buf[6 + 1]; |
1761 | 1762 | |
1762 | 1763 | if (byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0) |
1763 | 1764 | { |
… |
… |
edit_get_utf (WEdit * edit, long byte_index, int *char_width) |
1777 | 1778 | |
1778 | 1779 | if (res < 0) |
1779 | 1780 | { |
1780 | | ch = *str; |
1781 | | width = 0; |
| 1781 | int i; |
| 1782 | |
| 1783 | for (i = 0; i < 6; i++) |
| 1784 | buf[i] = edit_get_byte (edit, byte_index + i); |
| 1785 | |
| 1786 | buf[6] = '\0'; |
| 1787 | |
| 1788 | res = g_utf8_get_char_validated ((char *) buf, -1); |
| 1789 | if (res < 0) |
| 1790 | { |
| 1791 | ch = *str; |
| 1792 | width = 0; |
| 1793 | } |
| 1794 | else |
| 1795 | { |
| 1796 | ch = res; |
| 1797 | next_ch = g_utf8_next_char ((char *) buf); |
| 1798 | if (next_ch) |
| 1799 | { |
| 1800 | width = next_ch - (char *) buf; |
| 1801 | } |
| 1802 | else |
| 1803 | { |
| 1804 | ch = 0; |
| 1805 | width = 0; |
| 1806 | } |
| 1807 | } |
1782 | 1808 | } |
1783 | 1809 | else |
1784 | 1810 | { |