aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/qreg-commands.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2025-06-08 20:54:29 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2025-06-08 20:54:29 +0200
commitaaa1d51a4c85fcc627e88ef7cf5292d9c5f5f840 (patch)
tree34da0d4a3218c622dbd34816607a93e2227157ac /src/qreg-commands.c
parent36448a42917560ce00c13c1ad4d56f46c3614937 (diff)
downloadsciteco-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/qreg-commands.c')
-rw-r--r--src/qreg-commands.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qreg-commands.c b/src/qreg-commands.c
index 09c3549..0457e92 100644
--- a/src/qreg-commands.c
+++ b/src/qreg-commands.c
@@ -534,8 +534,9 @@ teco_state_getqregstring_got_register(teco_machine_main_t *ctx, teco_qreg_t *qre
if (!qreg->vtable->get_string(qreg, &str.data, &str.len, NULL, error))
return NULL;
- teco_undo_gsize(teco_ranges[0].from) = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0);
- teco_undo_gsize(teco_ranges[0].to) = teco_ranges[0].from + str.len;
+ sptr_t pos = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0);
+ teco_undo_int(teco_ranges[0].from) = teco_interface_bytes2glyphs(pos);
+ teco_undo_int(teco_ranges[0].to) = teco_interface_bytes2glyphs(pos + str.len);
teco_undo_guint(teco_ranges_count) = 1;
if (str.len > 0) {