diff options
author | Po Lu <luangruo@yahoo.com> | 2023-06-10 09:57:41 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2023-06-10 09:57:41 +0800 |
commit | a0b8f60ce79f93f37242a20d7b9a3e3b7ddc46a1 (patch) | |
tree | 63cc5b3c0d7c5c7a0375dc5b877c470e5ff2e0a1 /src/textconv.c | |
parent | b36dc0815ba753bc98b1e0b0fd21bb50ba90d8ae (diff) | |
download | emacs-a0b8f60ce79f93f37242a20d7b9a3e3b7ddc46a1.tar.gz |
Inherit surrounding text properties when inserting conversion text
* src/textconv.c (really_commit_text)
(really_set_composing_text): Improve behavior of certain
fontification mechanisms by inheriting text properties from
surrounding text.
Diffstat (limited to 'src/textconv.c')
-rw-r--r-- | src/textconv.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/textconv.c b/src/textconv.c index 3303ca246de..d86877b5515 100644 --- a/src/textconv.c +++ b/src/textconv.c @@ -624,7 +624,13 @@ really_commit_text (struct frame *f, EMACS_INT position, if (SCHARS (text)) { - Finsert (1, &text); + /* Insert the new text. Make sure to inherit text + properties from the surroundings: if this doesn't happen, + CC Mode fontification can get thrown off and become very + slow. */ + + insert_from_string (text, 0, 0, SCHARS (text), + SBYTES (text), true); record_buffer_change (start, PT, text); } @@ -686,7 +692,14 @@ really_commit_text (struct frame *f, EMACS_INT position, if (SCHARS (text)) { - Finsert (1, &text); + /* Insert the new text. Make sure to inherit text + properties from the surroundings: if this doesn't happen, + CC Mode fontification can get thrown off and become very + slow. */ + + insert_from_string (text, 0, 0, SCHARS (text), + SBYTES (text), true); + record_buffer_change (wanted, PT, text); } @@ -835,8 +848,12 @@ really_set_composing_text (struct frame *f, ptrdiff_t position, record_buffer_change (start, start, Qt); } - /* Insert the new text. */ - Finsert (1, &text); + /* Insert the new text. Make sure to inherit text properties from + the surroundings: if this doesn't happen, CC Mode fontification + can get thrown off and become very slow. */ + + insert_from_string (text, 0, 0, SCHARS (text), + SBYTES (text), true); if (start != PT) record_buffer_change (start, PT, Qt); |