From: Matthew Mondor Date: Tue, 29 Aug 2023 14:52:51 +0000 (+0000) Subject: AnalogTerm2: X-Git-Url: http://git.pulsar-zone.net/?a=commitdiff_plain;h=ab5fbcca4fb08e7c0b115fde2a671b92801a5c87;p=mmondor.git AnalogTerm2: - Update aliases - Add a forgotten memset(3) IRT X11 copy/paste selection clearing - Add more details in the intro header, including the font size - Add -q to request AT2 not to show the introduction header - Minor code cleanup, use explicit NULL test VS boolean test for ptr --- diff --git a/mmsoftware/analogterm2/src/main.c b/mmsoftware/analogterm2/src/main.c index c188b57..5e85aea 100644 --- a/mmsoftware/analogterm2/src/main.c +++ b/mmsoftware/analogterm2/src/main.c @@ -212,7 +212,7 @@ usage(void) " [-B [,]] [-j ] [-P] [-m ] [-M] [-d]\n" " [-D] [-S] [-p ] [-g ,] [-l ]\n" " [-f ] [-t] [-T [,]] [-U] [-z ]\n" - " [-Z ] [-e []]\n\n" + " [-Z ] [-q] [-e []]\n\n" "Where:\n" " -1 - Activate slow and smooth scrolling at startup.\n" " Also see -j for more details.\n" @@ -309,6 +309,7 @@ usage(void) " -Z - If -z is enabled, specify the number of bytes to read\n" " before sleeping. Useful when the scheduler cannot sleep\n" " for short enough delays.\n" + " -q - Quiet: do not display the intro header at startup.\n" " -e - Execute command and its arguments instead of $SHELL.\n" " Must be the last AnalogTerm2 argument if used, because\n" " other arguments will be passed to the command.\n" @@ -344,16 +345,17 @@ main(int argc, char **argv, char **envp) screen_t *screen = NULL; state_t *state = NULL; struct pollfd pfd[2]; - int ch, i; + int ch, i, cfg_quiet; char *command = NULL; bool color_set = false; cfg_setdefaults(); cfg_unicode = !locale_8bit(); + cfg_quiet = false; progname = strdup(argv[0]); while ((ch = getopt(argc, argv, - "?128uw:h:E:scC:Wr:R:bB:j:Pm:MdDStT:p:g:l:f:Uz:Z:e:")) != -1) { + "?128uw:h:E:scC:Wr:R:bB:j:Pm:MdDStT:p:g:l:f:Uz:Z:qe:")) != -1) { switch (ch) { case '1': cfg_slowscroll = cfg_smoothscroll = true; @@ -529,6 +531,9 @@ main(int argc, char **argv, char **envp) if ((i = atoi(optarg)) > -1) cfg_inputsleepskip = inputsleepskip = i; break; + case 'q': + cfg_quiet = true; + break; case 'e': { int l; @@ -615,10 +620,14 @@ endopt: /* * Fancy retro welcome message. */ + if (cfg_quiet) + goto noheader; + state_goto(state, 0, 1); - state_printf(state, 0, "(%dx%d, %dx%d)", + state_printf(state, 0, "(Win: %dx%d, Txt: %dx%d, Fnt: %dx%d)", screen->pixels_width, screen->pixels_height, - cfg_text_width, cfg_text_height); + cfg_text_width, cfg_text_height, + cfg_font_width, cfg_font_height); state_goto(state, 1, 1); state_prints(state, "READY", 0); state_goto(state, 1, (cfg_text_width / 2) - 17); @@ -637,6 +646,8 @@ endopt: state_prints(state, "Revision ", TMODE_DIM); state_prints(state, REVISION, TMODE_BOLD); state_prints(state, "\r\n\r\n", 0); + +noheader: state->text_updateall = true; draw_update_screen(screen, state); diff --git a/mmsoftware/analogterm2/src/screen.c b/mmsoftware/analogterm2/src/screen.c index 5266c0b..676ffba 100644 --- a/mmsoftware/analogterm2/src/screen.c +++ b/mmsoftware/analogterm2/src/screen.c @@ -351,12 +351,13 @@ kv(unsigned int state, const char *norm, const char *shift, bool ctrl_p = (state & XK_Control_R) != 0; bool shift_p = (state & (XK_Shift_L | XK_Shift_R)) != 0; - if (shiftctrl && ctrl_p && shift_p) + if (shiftctrl != NULL && ctrl_p && shift_p) return shiftctrl; - if (shift && shift_p) + if (shift != NULL && shift_p) return shift; - if (ctrl && ctrl_p) + if (ctrl != NULL && ctrl_p) return ctrl; + return norm; } @@ -744,6 +745,8 @@ screen_select_end(state_t *st, XButtonEvent *bev) /* Free any previous selection */ if (st->selected != NULL) { + (void)memset(st->selected, 0, + st->nselected * sizeof(uint32_t)); free(st->selected); st->selected = NULL; st->nselected = 0; diff --git a/mmsoftware/analogterm2/tests/at2-aliases.sh b/mmsoftware/analogterm2/tests/at2-aliases.sh index 49d91c5..0226688 100755 --- a/mmsoftware/analogterm2/tests/at2-aliases.sh +++ b/mmsoftware/analogterm2/tests/at2-aliases.sh @@ -100,6 +100,7 @@ alias atfast="printf '\033[?658467;65538;6h'" alias atslow="printf '\033[?658467;65538;15h'" alias atmixed1="printf '\033[?658467;65538;40;10h'" alias atmixed2="printf '\033[?658467;65538;50;10h'" +alias atmixed3="printf '\033[?658467;65538;95;5h'" alias atbright="printf '\033[?658467;65541h'" alias atnobright="printf '\033[?658467;65542h'" alias atblock="printf '\033[1 q'"