diff options
| author | Eli Zaretskii | 2024-03-09 04:18:53 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2024-03-09 04:18:53 -0500 |
| commit | 7405f0340b5ebfc8ccb903554d6d2d586611ccca (patch) | |
| tree | 146e1531ffb899ef2cde009e1f0637738fb8e060 /src | |
| parent | 5d9a8c3704c156cccea90a46362e6bfae0de87f2 (diff) | |
| parent | b9f7a2274f6a8352085d01c15bf9086ffe25f437 (diff) | |
| download | emacs-7405f0340b5ebfc8ccb903554d6d2d586611ccca.tar.gz emacs-7405f0340b5ebfc8ccb903554d6d2d586611ccca.zip | |
Merge from origin/emacs-29
b9f7a2274f6 ; Improve documentation of 'minibuffer-allow-text-propert...
5ffcca121bb ; Improve documentation of image properties
6e801077ae8 ; * src/composite.c (composition_compute_stop_pos): Add c...
Diffstat (limited to 'src')
| -rw-r--r-- | src/composite.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/composite.c b/src/composite.c index 111b1cea88b..e89d923168a 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -1147,12 +1147,12 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, | |||
| 1147 | } | 1147 | } |
| 1148 | else if (charpos > endpos) | 1148 | else if (charpos > endpos) |
| 1149 | { | 1149 | { |
| 1150 | /* Search backward for a pattern that may be composed and the | 1150 | /* Search backward for a pattern that may be composed such that |
| 1151 | position of (possibly) the last character of the match is | 1151 | the position of (possibly) the last character of the match is |
| 1152 | closest to (but not after) START. The reason for the last | 1152 | closest to (but not after) START. The reason for the last |
| 1153 | character is that set_iterator_to_next works in reverse order, | 1153 | character is that set_iterator_to_next works in reverse |
| 1154 | and thus we must stop at the last character for composition | 1154 | order, and thus we must stop at the last character for |
| 1155 | check. */ | 1155 | composition check. */ |
| 1156 | unsigned char *p; | 1156 | unsigned char *p; |
| 1157 | int len; | 1157 | int len; |
| 1158 | /* Limit byte position used in fast_looking_at. This is the | 1158 | /* Limit byte position used in fast_looking_at. This is the |
| @@ -1165,6 +1165,22 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, | |||
| 1165 | p = SDATA (string) + bytepos; | 1165 | p = SDATA (string) + bytepos; |
| 1166 | c = string_char_and_length (p, &len); | 1166 | c = string_char_and_length (p, &len); |
| 1167 | limit = bytepos + len; | 1167 | limit = bytepos + len; |
| 1168 | /* The algorithmic idea behind the loop below is somewhat tricky | ||
| 1169 | and subtle. Keep in mind that any arbitrarily long sequence | ||
| 1170 | of composable characters can potentially be composed to end | ||
| 1171 | at or before START. So the fact that we find a character C | ||
| 1172 | before START that can be composed with several following | ||
| 1173 | characters does not mean we can exit the loop, because some | ||
| 1174 | character before C could also be composed, yielding a longer | ||
| 1175 | composed sequence which ends closer to START. And since a | ||
| 1176 | composition can be arbitrarily long, it is very important to | ||
| 1177 | know where to stop the search back, because the default -- | ||
| 1178 | BEGV -- could be VERY far away. Since searching back is only | ||
| 1179 | needed when delivering bidirectional text reordered for | ||
| 1180 | display, and since no character composition can ever cross | ||
| 1181 | into another embedding level, the search could end when it | ||
| 1182 | gets to the end of the current embedding level, but this | ||
| 1183 | limit should be imposed by the caller. */ | ||
| 1168 | while (char_composable_p (c)) | 1184 | while (char_composable_p (c)) |
| 1169 | { | 1185 | { |
| 1170 | val = CHAR_TABLE_REF (Vcomposition_function_table, c); | 1186 | val = CHAR_TABLE_REF (Vcomposition_function_table, c); |