git.y1.nz

mtm

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

commit 909b6d527ecac0ef1cc6726954f348613046d8b6
parent 2f3cec92a43cb8440693b4133397a87f19b40e5d
Author: Rob King <jking@deadpixi.com>
Date:   Sun, 19 Feb 2017 22:58:53 -0600

Catch too-small views sooner.

Diffstat:
Mmtm.c5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mtm.c b/mtm.c @@ -29,6 +29,7 @@ #include "tmt.h" #include "config.h" +#define MAX(x, y) ((x) > (y)? (x) : (y)) #define CTL(x) ((x) & 0x1f) #define TOPAIR(fg, bg) (monochrome? 0 : (((fg) * 8) | (bg))) #define USAGE "usage: mtm [-m] [-e MILLISECONDS] [-c KEY]" @@ -350,8 +351,10 @@ draw(NODE *n, bool force) static void split(NODE *n, node_t t) { + int nh = t == VERTICAL? (n->h - 1) / 2 : n->h; + int nw = t == HORIZONTAL? (n->w - 1) / 2 : n->w; NODE *p = n->p; - NODE *v = newview(NULL, 0, 0, LINES, COLS); + NODE *v = newview(NULL, 0, 0, MAX(0, nh), MAX(0, nw)); if (!v) return; NODE *c = newcontainer(t, n->p, n->y, n->x, n->h, n->w, n, v);

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