git.y1.nz

mtm

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

commit 3e4ba2cccd52784f69d4f05736f82494d06f4011
parent 5685ae235a50914a8cd1b3b1d9eba71ba3507dc2
Author: Rob King <jking@deadpixi.com>
Date:   Sun, 19 Feb 2017 02:14:43 -0600

Track highest fd.

Diffstat:
Mmtm.c8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mtm.c b/mtm.c @@ -62,6 +62,7 @@ static NODE *root, *focused; static bool monochrome; static int commandkey = CTL(COMMAND_KEY); static fd_set fds; +static int nfds = 1; /* stdin */ static char iobuf[BUFSIZ + 1]; static void reshape(NODE *n, int y, int x, int h, int w); @@ -179,6 +180,7 @@ newview(NODE *p, int y, int x, int h, int w) } FD_SET(n->pt, &fds); + nfds = n->pt > nfds? n->pt : nfds; return n; } @@ -431,12 +433,12 @@ static void run(void) { while (root){ - fd_set nfds = fds; - if (select(FD_SETSIZE, &nfds, NULL, NULL, NULL) < 0) FD_ZERO(&nfds); + fd_set sfds = fds; + if (select(nfds + 1, &sfds, NULL, NULL, NULL) < 0) FD_ZERO(&sfds); while (handlechar(wgetch(focused->win))) ; - getinput(root, &nfds); + getinput(root, &sfds); refresh(); fixcursor(); }

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