aboutsummaryrefslogtreecommitdiffstats
path: root/src/textconv.c
diff options
context:
space:
mode:
authorPo Lu2023-06-06 10:06:10 +0800
committerPo Lu2023-06-06 10:06:10 +0800
commit5f09df3d6a359fabb2485c83549a0176a0ba2796 (patch)
treee852d4fa6ea0bddecbdb3c51e523dd77ca50ee1a /src/textconv.c
parent49ae645624740936421ec4bb814c4dc65f6a06e7 (diff)
downloademacs-5f09df3d6a359fabb2485c83549a0176a0ba2796.tar.gz
emacs-5f09df3d6a359fabb2485c83549a0176a0ba2796.zip
Improve undo behavior on Android
* lisp/simple.el (undo-auto-amalgamate): Update doc string to describe new amalgamating commands. (analyze-text-conversion): Make this an amalgamating command by default, unless a new line has been inserted. Also, shorten the undo boundary timer. * src/textconv.c (really_commit_text) (really_set_composing_text): Correctly report ephemeral deletions. (syms_of_textconv): Fix doc strings.
Diffstat (limited to 'src/textconv.c')
-rw-r--r--src/textconv.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/textconv.c b/src/textconv.c
index 0716cf7edbb..0dcf5bdcea8 100644
--- a/src/textconv.c
+++ b/src/textconv.c
@@ -600,7 +600,7 @@ really_commit_text (struct frame *f, EMACS_INT position,
600 /* Now delete whatever needs to go. */ 600 /* Now delete whatever needs to go. */
601 601
602 del_range (start, end); 602 del_range (start, end);
603 record_buffer_change (start, start, Qnil); 603 record_buffer_change (start, start, Qt);
604 604
605 /* Don't record changes if TEXT is empty. */ 605 /* Don't record changes if TEXT is empty. */
606 606
@@ -786,7 +786,7 @@ really_set_composing_text (struct frame *f, ptrdiff_t position,
786 { 786 {
787 del_range (start, end); 787 del_range (start, end);
788 set_point (start); 788 set_point (start);
789 record_buffer_change (start, start, Qnil); 789 record_buffer_change (start, start, Qt);
790 } 790 }
791 791
792 /* Now set the markers which denote the composition region. */ 792 /* Now set the markers which denote the composition region. */
@@ -808,14 +808,14 @@ really_set_composing_text (struct frame *f, ptrdiff_t position,
808 set_point (start); 808 set_point (start);
809 809
810 if (start != end) 810 if (start != end)
811 record_buffer_change (start, start, Qnil); 811 record_buffer_change (start, start, Qt);
812 } 812 }
813 813
814 /* Insert the new text. */ 814 /* Insert the new text. */
815 Finsert (1, &text); 815 Finsert (1, &text);
816 816
817 if (start != PT) 817 if (start != PT)
818 record_buffer_change (start, PT, Qnil); 818 record_buffer_change (start, PT, Qt);
819 819
820 /* Now move point to an appropriate location. */ 820 /* Now move point to an appropriate location. */
821 if (position <= 0) 821 if (position <= 0)
@@ -1927,27 +1927,24 @@ syms_of_textconv (void)
1927 doc: /* List of buffers that were last edited as a result of text conversion. 1927 doc: /* List of buffers that were last edited as a result of text conversion.
1928 1928
1929This list can be used while handling a `text-conversion' event to 1929This list can be used while handling a `text-conversion' event to
1930determine the changes which have taken place. 1930determine which changes have taken place.
1931 1931
1932Each element of the list describes a single edit in a buffer, of the 1932Each element of the list describes a single edit in a buffer, of the
1933form: 1933form:
1934 1934
1935 (BUFFER BEG END EPHEMERAL) 1935 (BUFFER BEG END EPHEMERAL)
1936 1936
1937If an insertion or a change occured, then BEG and END are markers 1937If an insertion or an edit to the buffer text is described, then BEG
1938which denote the bounds of the text that was changed or inserted. 1938and END are markers which denote the bounds of the text that was
1939 1939changed or inserted. If a deletion is described, then BEG and END are
1940If EPHEMERAL is t, then the input method will shortly make more 1940the same object.
1941changes to the text, so any actions that would otherwise be taken
1942(such as indenting or automatically filling text) should not take
1943place; otherwise, it is a string describing the text which was
1944inserted.
1945 1941
1946If a deletion occured before point, then BEG and END are the same 1942If EPHEMERAL is t, then the input method is preparing to make further
1947object, and EPHEMERAL is the text which was deleted. 1943edits to the text, so any actions that would otherwise be taken, such
1944as indenting or automatically filling text, should not take place.
1948 1945
1949If a deletion occured after point, then BEG and END are also the same 1946Otherwise, it is either a string containing text that was inserted,
1950object, but EPHEMERAL is nil. 1947text deleted before point, or nil if text was deleted after point.
1951 1948
1952The list contents are ordered later edits first, so you must iterate 1949The list contents are ordered later edits first, so you must iterate
1953through the list in reverse. */); 1950through the list in reverse. */);