git.y1.nz

mtm

Ncurses-based terminal multiplexer
download: https://git.y1.nz/archives/mtm.tar.gz
Files | Log | Refs

commit 40ed59c9c6457f7423e96f4a61dde4fbbc0ba10c
parent 378a8abdb3db9f71ac2a06e571e2b37743813f61
Author: Rob King <jking@deadpixi.com>
Date:   Wed,  8 Mar 2017 01:10:07 -0600

Fix miscount in ECH. Style fixes.

Diffstat:
MMakefile2+-
Mtmt.c8+++-----
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,5 +1,5 @@ CC := gcc -CFLAGS ?= -O3 -std=c99 -Wall -Wextra -pedantic +CFLAGS ?= -g -std=c99 -Wall -Wextra -pedantic FEATURES ?= -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE_EXTENDED -DTMT_HAS_WCWIDTH HEADERS ?= LIBPATH ?= diff --git a/tmt.c b/tmt.c @@ -169,8 +169,7 @@ HANDLER(ed) } HANDLER(ich) - size_t n = P1(0); /* XXX use MAX */ - if (n > s->ncol - c->c - 1) n = s->ncol - c->c - 1; + size_t n = MIN(P1(0), s->ncol - c->c - 1); memmove(l->chars + c->c + n, l->chars + c->c, MIN(s->ncol - 1 - c->c, @@ -179,8 +178,7 @@ HANDLER(ich) } HANDLER(dch) - size_t n = P1(0); /* XXX use MAX */ - if (n > s->ncol - c->c) n = s->ncol - c->c; + size_t n = MIN(P1(0), s->ncol - c->c); memmove(l->chars + c->c, l->chars + c->c + n, (s->ncol - c->c - n) * sizeof(TMTCHAR)); @@ -292,7 +290,7 @@ handlechar(TMT *vt, char i) DO(S_ARG, "P", dch(vt)) DO(S_ARG, "S", scrup(vt, 0, P1(0))) DO(S_ARG, "T", scrdn(vt, 0, P1(0))) - DO(S_ARG, "X", clearline(vt, l, c->c, P1(0))) + DO(S_ARG, "X", clearline(vt, l, c->c, c->c + P1(0))) DO(S_ARG, "Z", while (c->c && t[--c->c].c != L'*')) DO(S_ARG, "b", rep(vt)); DO(S_ARG, "c", CB(vt, TMT_MSG_ANSWER, "\033[?6c"))

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.