Skip to content
Snippets Groups Projects
Commit 87731220 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

New @-code: !x to perform Ctrl-A style terminal/attribute control

Most Ctrl-A code terminal/attribute effects can now be invoked via @!x@ where x is one or more Ctrl-A sequence operands (e.g. @!B@ to set the current attribute to blue, @!P@ to pause the terminal). Multiple attribute codes may be specified in a single @!x@ sequence. Both upper and lowercase attribute codes are supported. The "^A@" sequence is not supported, but there's already an @-code to perform the equivalent operation ("SHOW:20").

Rationale: when using PabloDraw to edit display (e.g. .msg) files, there was no easy way to explicitly clear (set to "normal") the current attributes at the end of a line of text. If that line of text contained a background color and the line caused the terminal to scroll, that background color would fill the next/new line resulting in some potential undesirable effects. There are 2 common solutions to this problem: either clear the screen before displaying the file (not always desirable) or clear the attributes at the end of the line (before the CR/LF). This can now be achieved by adding a @!N@ (the equivalent of Ctrl-AN for "normal" attributes) to the end of a line. There's no way to insert custom Ctrl-A sequences or other way to force PabloDraw to clear the attributes at the end of a line, that I found.

I chose the '!' character because it's (on my keyboard anyway) the Shift-1 key and Ctrl-A is ASCII 1. I considered a sequence such as @A:x@, but that's one more character and since this sequence usually won't display anything, a shorter sequence is likely preferred. For the shortest-possible sequence, use Ctrl-A sequences instead. However, for many consecutive Ctrl-A sequences, the @-code equivalent might actually end up being shorter(!). @-codes aren't support in as many places in Synchronet where Ctrl-A codes are supported (for security reasons), so it's not like this is going to replace the use of Ctrl-A codes everywhere.
parent 0e270c4e
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2438 passed
......@@ -120,6 +120,13 @@ int sbbs_t::show_atcode(const char *instr, JSObject* obj)
return len;
}
// @!x@ for Ctrl-A x equivalent(s) */
if(*sp == '!') {
for(p = sp + 1; *p != '\0' && *p != '@'; p++)
ctrl_a(*p);
return len;
}
disp_len=len;
if((p = strchr(sp, '|')) != NULL) {
if(strchr(p, 'T') != NULL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment