aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-02-18 23:09:30 +0800
committerPo Lu2023-02-18 23:09:30 +0800
commita61f9cb77ced0607e4607bc5d82ae06165e6138d (patch)
tree36de4bab015344008d8bdbe122840cf6e53ec131 /src
parentfa1b27930ea5f61d92880c3c252774f2f97f529d (diff)
downloademacs-a61f9cb77ced0607e4607bc5d82ae06165e6138d.tar.gz
emacs-a61f9cb77ced0607e4607bc5d82ae06165e6138d.zip
Update Android port
* doc/emacs/input.texi (On-Screen Keyboards): Document `touch-screen-always-display'. * doc/lispref/commands.texi (Misc Events): Improve documentation of text conversion events. * java/org/gnu/emacs/EmacsDialog.java (toAlertDialog, display1): Reorder buttons to make more sense. * lisp/elec-pair.el (electric-pair-analyze-conversion): New function. * lisp/simple.el (analyze-text-conversion): Improve integration with electric pair modes. * lisp/term.el (term-mode): Always display the onscreen keyboard. * lisp/touch-screen.el (touch-screen-display-keyboard) (touch-screen-handle-point-up): Respect new options. * src/textconv.c (really_set_composing_text): Stop widenining unnecessarily. (really_delete_surrounding_text): Really delete surrounding text. Give text conversion analyzers the buffer text. (syms_of_textconv): Update doc string.
Diffstat (limited to 'src')
-rw-r--r--src/textconv.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/textconv.c b/src/textconv.c
index 50146820dce..1ca5f0488f8 100644
--- a/src/textconv.c
+++ b/src/textconv.c
@@ -702,11 +702,8 @@ really_set_composing_text (struct frame *f, ptrdiff_t position,
702 } 702 }
703 else 703 else
704 { 704 {
705 /* Delete the text between the start of the composition region 705 /* Delete the text between the start of the composing region and
706 and its end. TODO: avoid this widening. */ 706 its end. */
707 record_unwind_protect (save_restriction_restore,
708 save_restriction_save ());
709 Fwiden ();
710 start = marker_position (f->conversion.compose_region_start); 707 start = marker_position (f->conversion.compose_region_start);
711 end = marker_position (f->conversion.compose_region_end); 708 end = marker_position (f->conversion.compose_region_end);
712 del_range (start, end); 709 del_range (start, end);
@@ -844,6 +841,7 @@ really_delete_surrounding_text (struct frame *f, ptrdiff_t left,
844 specpdl_ref count; 841 specpdl_ref count;
845 ptrdiff_t start, end, a, b, a1, b1, lstart, rstart; 842 ptrdiff_t start, end, a, b, a1, b1, lstart, rstart;
846 struct window *w; 843 struct window *w;
844 Lisp_Object text;
847 845
848 /* If F's old selected window is no longer live, fail. */ 846 /* If F's old selected window is no longer live, fail. */
849 847
@@ -888,21 +886,25 @@ really_delete_surrounding_text (struct frame *f, ptrdiff_t left,
888 start = max (BEGV, lstart - left); 886 start = max (BEGV, lstart - left);
889 end = min (ZV, rstart + right); 887 end = min (ZV, rstart + right);
890 888
891 del_range (start, end); 889 text = del_range_1 (start, end, false, true);
892 record_buffer_change (start, start, Qnil); 890 record_buffer_change (start, start, text);
893 } 891 }
894 else 892 else
895 { 893 {
896 start = max (BEGV, lstart - left); 894 /* Don't record a deletion if the text which was deleted lies
897 end = lstart; 895 after point. */
898
899 del_range (start, end);
900 record_buffer_change (start, start, Qnil);
901 896
902 start = rstart; 897 start = rstart;
903 end = min (ZV, rstart + right); 898 end = min (ZV, rstart + right);
904 del_range (start, end); 899 text = del_range_1 (start, end, false, true);
905 record_buffer_change (start, start, Qnil); 900 record_buffer_change (start, start, Qnil);
901
902 /* Now delete what must be deleted on the left. */
903
904 start = max (BEGV, lstart - left);
905 end = lstart;
906 text = del_range_1 (start, end, false, true);
907 record_buffer_change (start, start, text);
906 } 908 }
907 909
908 /* if the mark is now equal to start, deactivate it. */ 910 /* if the mark is now equal to start, deactivate it. */
@@ -1701,7 +1703,8 @@ syms_of_textconv (void)
1701 DEFSYM (Qtext_conversion, "text-conversion"); 1703 DEFSYM (Qtext_conversion, "text-conversion");
1702 DEFSYM (Qpush_mark, "push-mark"); 1704 DEFSYM (Qpush_mark, "push-mark");
1703 DEFSYM (Qunderline, "underline"); 1705 DEFSYM (Qunderline, "underline");
1704 DEFSYM (Qoverriding_text_conversion_style, "overriding-text-conversion-style"); 1706 DEFSYM (Qoverriding_text_conversion_style,
1707 "overriding-text-conversion-style");
1705 1708
1706 DEFVAR_LISP ("text-conversion-edits", Vtext_conversion_edits, 1709 DEFVAR_LISP ("text-conversion-edits", Vtext_conversion_edits,
1707 doc: /* List of buffers that were last edited as a result of text conversion. 1710 doc: /* List of buffers that were last edited as a result of text conversion.
@@ -1722,8 +1725,14 @@ changes to the text, so any actions that would otherwise be taken
1722place; otherwise, it is a string describing the text which was 1725place; otherwise, it is a string describing the text which was
1723inserted. 1726inserted.
1724 1727
1725If a deletion occured, then BEG and END are the same, and EPHEMERAL is 1728If a deletion occured before point, then BEG and END are the same, and
1726nil. */); 1729EPHEMERAL is the text which was deleted.
1730
1731If a deletion occured after point, then BEG and END are also the same,
1732but EPHEMERAL is nil.
1733
1734The list contents are ordered later edits first, so you must iterate
1735through the list in reverse. */);
1727 Vtext_conversion_edits = Qnil; 1736 Vtext_conversion_edits = Qnil;
1728 1737
1729 DEFVAR_LISP ("overriding-text-conversion-style", 1738 DEFVAR_LISP ("overriding-text-conversion-style",