diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-06-08 20:54:29 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-06-08 20:54:29 +0200 |
commit | aaa1d51a4c85fcc627e88ef7cf5292d9c5f5f840 (patch) | |
tree | 34da0d4a3218c622dbd34816607a93e2227157ac /src/spawn.c | |
parent | 36448a42917560ce00c13c1ad4d56f46c3614937 (diff) | |
download | sciteco-aaa1d51a4c85fcc627e88ef7cf5292d9c5f5f840.tar.gz |
^S/^Y calculates the glyph offsets earlier
* Previously, deleting text after a text match or insertion
could result in wrong ^S/^Y results.
In particular, the amount of characters deleted by <FD> at the end of a buffer
couldn't be queried.
* This also fixes the M#rf (reflow paragraph) macro.
Diffstat (limited to 'src/spawn.c')
-rw-r--r-- | src/spawn.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/spawn.c b/src/spawn.c index d51dbb1..187de27 100644 --- a/src/spawn.c +++ b/src/spawn.c @@ -420,8 +420,9 @@ teco_state_execute_done(teco_machine_main_t *ctx, const teco_string_t *str, GErr teco_interface_ssm(SCI_DELETERANGE, teco_spawn_ctx.from, teco_spawn_ctx.to - teco_spawn_ctx.from); - teco_undo_gsize(teco_ranges[0].from) = teco_spawn_ctx.from; - teco_undo_gsize(teco_ranges[0].to) = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0); + sptr_t pos = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0); + teco_undo_int(teco_ranges[0].from) = teco_interface_bytes2glyphs(teco_spawn_ctx.from); + teco_undo_int(teco_ranges[0].to) = teco_interface_bytes2glyphs(pos); teco_undo_guint(teco_ranges_count) = 1; } teco_interface_ssm(SCI_ENDUNDOACTION, 0, 0); |