diff options
| author | Po Lu | 2023-06-06 10:06:10 +0800 |
|---|---|---|
| committer | Po Lu | 2023-06-06 10:06:10 +0800 |
| commit | 5f09df3d6a359fabb2485c83549a0176a0ba2796 (patch) | |
| tree | e852d4fa6ea0bddecbdb3c51e523dd77ca50ee1a /src/textconv.c | |
| parent | 49ae645624740936421ec4bb814c4dc65f6a06e7 (diff) | |
| download | emacs-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.c | 31 |
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 | ||
| 1929 | This list can be used while handling a `text-conversion' event to | 1929 | This list can be used while handling a `text-conversion' event to |
| 1930 | determine the changes which have taken place. | 1930 | determine which changes have taken place. |
| 1931 | 1931 | ||
| 1932 | Each element of the list describes a single edit in a buffer, of the | 1932 | Each element of the list describes a single edit in a buffer, of the |
| 1933 | form: | 1933 | form: |
| 1934 | 1934 | ||
| 1935 | (BUFFER BEG END EPHEMERAL) | 1935 | (BUFFER BEG END EPHEMERAL) |
| 1936 | 1936 | ||
| 1937 | If an insertion or a change occured, then BEG and END are markers | 1937 | If an insertion or an edit to the buffer text is described, then BEG |
| 1938 | which denote the bounds of the text that was changed or inserted. | 1938 | and END are markers which denote the bounds of the text that was |
| 1939 | 1939 | changed or inserted. If a deletion is described, then BEG and END are | |
| 1940 | If EPHEMERAL is t, then the input method will shortly make more | 1940 | the same object. |
| 1941 | changes to the text, so any actions that would otherwise be taken | ||
| 1942 | (such as indenting or automatically filling text) should not take | ||
| 1943 | place; otherwise, it is a string describing the text which was | ||
| 1944 | inserted. | ||
| 1945 | 1941 | ||
| 1946 | If a deletion occured before point, then BEG and END are the same | 1942 | If EPHEMERAL is t, then the input method is preparing to make further |
| 1947 | object, and EPHEMERAL is the text which was deleted. | 1943 | edits to the text, so any actions that would otherwise be taken, such |
| 1944 | as indenting or automatically filling text, should not take place. | ||
| 1948 | 1945 | ||
| 1949 | If a deletion occured after point, then BEG and END are also the same | 1946 | Otherwise, it is either a string containing text that was inserted, |
| 1950 | object, but EPHEMERAL is nil. | 1947 | text deleted before point, or nil if text was deleted after point. |
| 1951 | 1948 | ||
| 1952 | The list contents are ordered later edits first, so you must iterate | 1949 | The list contents are ordered later edits first, so you must iterate |
| 1953 | through the list in reverse. */); | 1950 | through the list in reverse. */); |