diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-07-26 00:37:43 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-07-26 00:42:15 +0300 |
commit | eb6f7a82045ad78553fca98c54a51366c55bd7a4 (patch) | |
tree | ff0cca8d3dfb71afe832e73616867cd09fdac22c /src/qreg-commands.c | |
parent | 574b46657cd5b752597384b31f37dd6a07f063d8 (diff) | |
download | sciteco-eb6f7a82045ad78553fca98c54a51366c55bd7a4.tar.gz |
implemented the <T> (typeout) command for printing to the terminal from the current buffer
* refactored some code that is common with Xq into teco_get_range_args().
Diffstat (limited to 'src/qreg-commands.c')
-rw-r--r-- | src/qreg-commands.c | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/src/qreg-commands.c b/src/qreg-commands.c index e9f80fb..5055058 100644 --- a/src/qreg-commands.c +++ b/src/qreg-commands.c @@ -780,39 +780,10 @@ teco_state_copytoqreg_got_register(teco_machine_main_t *ctx, teco_qreg_t *qreg, if (ctx->flags.mode > TECO_MODE_NORMAL) return &teco_state_start; - gssize from, len; /* in bytes */ + gsize from, len; - if (!teco_expressions_eval(FALSE, error)) + if (!teco_get_range_args("X", &from, &len, error)) return NULL; - if (teco_expressions_args() <= 1) { - teco_int_t line; - - from = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0); - if (!teco_expressions_pop_num_calc(&line, teco_num_sign, error)) - return NULL; - line += teco_interface_ssm(SCI_LINEFROMPOSITION, from, 0); - - if (!teco_validate_line(line)) { - teco_error_range_set(error, "X"); - return NULL; - } - - len = teco_interface_ssm(SCI_POSITIONFROMLINE, line, 0) - from; - - if (len < 0) { - from += len; - len *= -1; - } - } else { - gssize to = teco_interface_glyphs2bytes(teco_expressions_pop_num(0)); - from = teco_interface_glyphs2bytes(teco_expressions_pop_num(0)); - len = to - from; - - if (len < 0 || from < 0 || to < 0) { - teco_error_range_set(error, "X"); - return NULL; - } - } /* * NOTE: This does not use SCI_GETRANGEPOINTER+SCI_GETGAPPOSITION |