Revision: 2784
http://tmux.svn.sourceforge.net/tmux/?rev=2784&view=rev
Author: tcunha
Date: 2012-05-03 16:55:48 +0000 (Thu, 03 May 2012)
Log Message:
-----------
Sync OpenBSD patchset 1102:
Add a buffer with all input from last ground state, will be used for
control mode. From George Nachman.
Modified Paths:
--------------
trunk/input.c
trunk/tmux.h
Modified: trunk/input.c
===================================================================
--- trunk/input.c 2012-04-24 16:24:37 UTC (rev 2783)
+++ trunk/input.c 2012-05-03 16:55:48 UTC (rev 2784)
@@ -47,9 +47,11 @@
*/
/* Helper functions. */
+struct input_transition;
int input_split(struct input_ctx *);
int input_get(struct input_ctx *, u_int, int, int);
void input_reply(struct input_ctx *, const char *, ...);
+void input_set_state(struct window_pane *, const struct input_transition *);
/* Transition entry/exit handlers. */
void input_clear(struct input_ctx *);
@@ -692,14 +694,36 @@
ictx->state = &input_state_ground;
ictx->flags = 0;
+
+ ictx->since_ground = evbuffer_new();
}
/* Destroy input parser. */
void
-input_free(unused struct window_pane *wp)
+input_free(struct window_pane *wp)
{
+ if (wp != NULL)
+ evbuffer_free(wp->ictx.since_ground);
}
+/* Change input state. */
+void
+input_set_state(struct window_pane *wp, const struct input_transition *itr)
+{
+ struct input_ctx *ictx = &wp->ictx;
+ struct evbuffer *ground_evb = ictx->since_ground;
+
+ if (ictx->state->exit != NULL)
+ ictx->state->exit(ictx);
+
+ if (itr->state == &input_state_ground)
+ evbuffer_drain(ground_evb, EVBUFFER_LENGTH(ground_evb));
+
+ ictx->state = itr->state;
+ if (ictx->state->enter != NULL)
+ ictx->state->enter(ictx);
+}
+
/* Parse input. */
void
input_parse(struct window_pane *wp)
@@ -755,13 +779,12 @@
continue;
/* And switch state, if necessary. */
- if (itr->state != NULL) {
- if (ictx->state->exit != NULL)
- ictx->state->exit(ictx);
- ictx->state = itr->state;
- if (ictx->state->enter != NULL)
- ictx->state->enter(ictx);
- }
+ if (itr->state != NULL)
+ input_set_state(wp, itr);
+
+ /* If not in ground state, save input. */
+ if (ictx->state != &input_state_ground)
+ evbuffer_add(ictx->since_ground, &ictx->ch, 1);
}
/* Close the screen. */
Modified: trunk/tmux.h
===================================================================
--- trunk/tmux.h 2012-04-24 16:24:37 UTC (rev 2783)
+++ trunk/tmux.h 2012-05-03 16:55:48 UTC (rev 2784)
@@ -773,6 +773,12 @@
#define INPUT_DISCARD 0x1
const struct input_state *state;
+
+ /*
+ * All input received since we were last in the ground state. Sent to
+ * control clients on connection.
+ */
+ struct evbuffer *since_ground;
};
/*
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs