git.y1.nz

mtm

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

commit 89e27822e6359162c774a01c3911ffa9f053dacc
parent 8eed554e63c952c3501be24a4f99c9403d8e6a7f
Author: Rob King <deadpixi@users.noreply.github.com>
Date:   Fri, 12 Jul 2019 09:08:41 -0600

Merge pull request #28 from davidkrauser/support-other-pane

Add support for switching to previous pane.
Diffstat:
Mconfig.def.h1+
Mmtm.c6+++++-
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h @@ -25,6 +25,7 @@ #define MOVE_DOWN CODE(KEY_DOWN) #define MOVE_RIGHT CODE(KEY_RIGHT) #define MOVE_LEFT CODE(KEY_LEFT) +#define MOVE_OTHER KEY(L'o') /* The split terminal keys. */ #define HSPLIT KEY(L'h') diff --git a/mtm.c b/mtm.c @@ -68,7 +68,7 @@ struct COLORTABLE{ /*** GLOBALS AND PROTOTYPES */ static COLORTABLE ctable[MAXCTABLE]; -static NODE *root, *focused; +static NODE *root, *focused, *lastfocused = NULL; static int commandkey = CTL(COMMAND_KEY), nfds = 1; /* stdin */ static fd_set fds; static char iobuf[BUFSIZ + 1]; @@ -472,6 +472,8 @@ static void freenode(NODE *n, bool recurse) /* Free a node. */ { if (n){ + if (lastfocused == n) + lastfocused = NULL; if (n->win) delwin(n->win); if (recurse) @@ -575,6 +577,7 @@ focus(NODE *n) /* Focus a node. */ if (!n) return; else if (n->t == VIEW){ + lastfocused = focused; focused = n; updatetitle(); wnoutrefresh(n->win); @@ -780,6 +783,7 @@ handlechar(int r, int k) /* Handle a single input character. */ DO(true, MOVE_DOWN, focus(findnode(root, BELOW(focused)))) DO(true, MOVE_LEFT, focus(findnode(root, LEFT(focused)))) DO(true, MOVE_RIGHT, focus(findnode(root, RIGHT(focused)))) + DO(true, MOVE_OTHER, focus(lastfocused)) DO(true, HSPLIT, split(focused, HORIZONTAL)) DO(true, VSPLIT, split(focused, VERTICAL)) DO(true, DELETE_NODE, deletenode(focused))

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