aboutsummaryrefslogtreecommitdiffstats
path: root/src/textconv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/textconv.c')
-rw-r--r--src/textconv.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/textconv.c b/src/textconv.c
index dcf016104fe..d8166bcfd03 100644
--- a/src/textconv.c
+++ b/src/textconv.c
@@ -676,10 +676,11 @@ really_commit_text (struct frame *f, EMACS_INT position,
676} 676}
677 677
678/* Remove the composition region on the frame F, while leaving its 678/* Remove the composition region on the frame F, while leaving its
679 contents intact. */ 679 contents intact. If UPDATE, also notify the input method of the
680 change. */
680 681
681static void 682static void
682really_finish_composing_text (struct frame *f) 683really_finish_composing_text (struct frame *f, bool update)
683{ 684{
684 if (!NILP (f->conversion.compose_region_start)) 685 if (!NILP (f->conversion.compose_region_start))
685 { 686 {
@@ -687,6 +688,10 @@ really_finish_composing_text (struct frame *f)
687 Fset_marker (f->conversion.compose_region_end, Qnil, Qnil); 688 Fset_marker (f->conversion.compose_region_end, Qnil, Qnil);
688 f->conversion.compose_region_start = Qnil; 689 f->conversion.compose_region_start = Qnil;
689 f->conversion.compose_region_end = Qnil; 690 f->conversion.compose_region_end = Qnil;
691
692 if (update && text_interface
693 && text_interface->compose_region_changed)
694 (*text_interface->compose_region_changed) (f);
690 } 695 }
691 696
692 /* Delete the composition region overlay. */ 697 /* Delete the composition region overlay. */
@@ -796,7 +801,7 @@ really_set_composing_text (struct frame *f, ptrdiff_t position,
796 the documentation, but is ultimately what programs expect. */ 801 the documentation, but is ultimately what programs expect. */
797 802
798 if (!SCHARS (text)) 803 if (!SCHARS (text))
799 really_finish_composing_text (f); 804 really_finish_composing_text (f, false);
800 805
801 /* If PT hasn't changed, the conversion region definitely has. 806 /* If PT hasn't changed, the conversion region definitely has.
802 Otherwise, redisplay will update the input method instead. */ 807 Otherwise, redisplay will update the input method instead. */
@@ -838,7 +843,7 @@ really_set_composing_region (struct frame *f, ptrdiff_t start,
838 843
839 if (max (0, start) == max (0, end)) 844 if (max (0, start) == max (0, end))
840 { 845 {
841 really_finish_composing_text (f); 846 really_finish_composing_text (f, false);
842 return; 847 return;
843 } 848 }
844 849
@@ -1167,7 +1172,7 @@ handle_pending_conversion_events_1 (struct frame *f,
1167 break; 1172 break;
1168 1173
1169 case TEXTCONV_FINISH_COMPOSING_TEXT: 1174 case TEXTCONV_FINISH_COMPOSING_TEXT:
1170 really_finish_composing_text (f); 1175 really_finish_composing_text (f, !NILP (data));
1171 break; 1176 break;
1172 1177
1173 case TEXTCONV_SET_COMPOSING_TEXT: 1178 case TEXTCONV_SET_COMPOSING_TEXT:
@@ -1360,16 +1365,20 @@ commit_text (struct frame *f, Lisp_Object string,
1360/* Remove the composition region and its overlay from F's current 1365/* Remove the composition region and its overlay from F's current
1361 buffer. Leave the text being composed intact. 1366 buffer. Leave the text being composed intact.
1362 1367
1368 If UPDATE, call `compose_region_changed' after the region is
1369 removed.
1370
1363 COUNTER means the same as in `start_batch_edit'. */ 1371 COUNTER means the same as in `start_batch_edit'. */
1364 1372
1365void 1373void
1366finish_composing_text (struct frame *f, unsigned long counter) 1374finish_composing_text (struct frame *f, unsigned long counter,
1375 bool update)
1367{ 1376{
1368 struct text_conversion_action *action, **last; 1377 struct text_conversion_action *action, **last;
1369 1378
1370 action = xmalloc (sizeof *action); 1379 action = xmalloc (sizeof *action);
1371 action->operation = TEXTCONV_FINISH_COMPOSING_TEXT; 1380 action->operation = TEXTCONV_FINISH_COMPOSING_TEXT;
1372 action->data = Qnil; 1381 action->data = update ? Qt : Qnil;
1373 action->next = NULL; 1382 action->next = NULL;
1374 action->counter = counter; 1383 action->counter = counter;
1375 for (last = &f->conversion.actions; *last; last = &(*last)->next) 1384 for (last = &f->conversion.actions; *last; last = &(*last)->next)