diff options
Diffstat (limited to 'src/spawn.c')
| -rw-r--r-- | src/spawn.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/spawn.c b/src/spawn.c index 0492bbf..b1cd305 100644 --- a/src/spawn.c +++ b/src/spawn.c @@ -222,8 +222,8 @@ teco_state_execute_initial(teco_machine_main_t *ctx, GError **error) default: /* pipe and replace character range */ - teco_spawn_ctx.to = teco_interface_glyphs2bytes(teco_expressions_pop_num(0)); - teco_spawn_ctx.from = teco_interface_glyphs2bytes(teco_expressions_pop_num(0)); + teco_spawn_ctx.to = teco_interface_glyphs2bytes_absdot(teco_expressions_pop_num(0)); + teco_spawn_ctx.from = teco_interface_glyphs2bytes_absdot(teco_expressions_pop_num(0)); rc = teco_bool(teco_spawn_ctx.from <= teco_spawn_ctx.to && teco_spawn_ctx.from >= 0 && teco_spawn_ctx.to >= 0); } @@ -424,6 +424,8 @@ teco_state_execute_done(teco_machine_main_t *ctx, teco_string_t str, GError **er g_source_attach(teco_spawn_ctx.stdout_src, teco_spawn_ctx.mainctx); if (!teco_spawn_ctx.register_argument) { + teco_undo_int(teco_ranges[0].from) = teco_interface_bytes2glyphs_absdot(teco_spawn_ctx.from); + if (teco_current_doc_must_undo()) undo__teco_interface_ssm(SCI_GOTOPOS, teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0), 0); @@ -438,9 +440,12 @@ teco_state_execute_done(teco_machine_main_t *ctx, teco_string_t str, GError **er teco_spawn_ctx.to - teco_spawn_ctx.from); 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_int_t to = teco_interface_bytes2glyphs_rel(teco_ranges[0].from, teco_spawn_ctx.from, + pos - teco_spawn_ctx.from); + teco_undo_int(teco_ranges[0].to) = to; teco_undo_guint(teco_ranges_count) = 1; + + teco_current_doc_set_dot(to); } teco_interface_ssm(SCI_ENDUNDOACTION, 0, 0); |
