diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-07-25 14:12:32 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-07-26 00:42:15 +0300 |
commit | 24c3bfc4f18f06a465b70afa45783d568402abdf (patch) | |
tree | e3833d4299aa91a9dae430ef2d745a5103b59bf5 | |
parent | a0121b5e4b2b1d7a8f697ef5ee1e9db2bd427bc2 (diff) | |
download | sciteco-24c3bfc4f18f06a465b70afa45783d568402abdf.tar.gz |
implemented <:Gq> for printing the Q-Register string as a message instead of inserting it
-rw-r--r-- | doc/sciteco.1.in | 12 | ||||
-rw-r--r-- | src/core-commands.c | 3 | ||||
-rw-r--r-- | src/qreg-commands.c | 12 |
3 files changed, 25 insertions, 2 deletions
diff --git a/doc/sciteco.1.in b/doc/sciteco.1.in index 82c3376..78f5748 100644 --- a/doc/sciteco.1.in +++ b/doc/sciteco.1.in @@ -501,6 +501,18 @@ In order to execute a stand-alone script or custom profile macro: .EE .RE . +.ig \" FIXME: Requires --quiet to be an useful example +.LP +In order to query the installation path of the standard library, +which is useful for authors of third-party macro packages: +.RS +.SCITECO_TT +.EX +@PACKAGE@ -qe ':G[$SCITECOPATH]' +.SCITECO_TT_END +.EE +.RE +.. . .SH SEE ALSO . diff --git a/src/core-commands.c b/src/core-commands.c index 257e29d..e67aa2f 100644 --- a/src/core-commands.c +++ b/src/core-commands.c @@ -595,7 +595,8 @@ teco_state_start_input(teco_machine_main_t *ctx, gunichar chr, GError **error) ['['] = {&teco_state_pushqreg}, [']'] = {&teco_state_popqreg, .modifier_colon = 1}, - ['G'] = {&teco_state_getqregstring}, + ['G'] = {&teco_state_getqregstring, + .modifier_colon = 1}, ['Q'] = {&teco_state_queryqreg, .modifier_colon = 1}, ['U'] = {&teco_state_setqreginteger, diff --git a/src/qreg-commands.c b/src/qreg-commands.c index a1da5f9..e9f80fb 100644 --- a/src/qreg-commands.c +++ b/src/qreg-commands.c @@ -545,6 +545,11 @@ 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; + if (teco_machine_main_eval_colon(ctx)) { + teco_interface_msg_literal(TECO_MSG_USER, str.data, str.len); + return &teco_state_start; + } + sptr_t pos = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0); if (str.len > 0) { @@ -565,10 +570,15 @@ teco_state_getqregstring_got_register(teco_machine_main_t *ctx, teco_qreg_t *qre } /*$ G Gq get paste - * Gq -- Insert Q-Register string + * Gq -- Insert or print Q-Register string + * :Gq * * Inserts the string of Q-Register <q> into the buffer * at its current position. + * If colon-modified prints the string as a message + * (i.e. to the terminal and/or in the message area) instead + * of modifying the current buffer. + * * Specifying an undefined <q> yields an error. */ TECO_DEFINE_STATE_EXPECTQREG(teco_state_getqregstring); |