Revision: 2666
http://tmux.svn.sourceforge.net/tmux/?rev=2666&view=rev
Author: tcunha
Date: 2012-01-21 19:31:59 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
Sync OpenBSD patchset 1004:
Add a -R flag to send-keys to reset the terminal. Written ages ago and
Suggested by someone, I forget who.
Modified Paths:
--------------
trunk/cmd-send-keys.c
trunk/input.c
trunk/screen-write.c
trunk/tmux.1
trunk/tmux.h
Modified: trunk/cmd-send-keys.c
===================================================================
--- trunk/cmd-send-keys.c 2012-01-21 19:30:07 UTC (rev 2665)
+++ trunk/cmd-send-keys.c 2012-01-21 19:31:59 UTC (rev 2666)
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <stdlib.h>
+#include <string.h>
#include "tmux.h"
@@ -30,8 +31,8 @@
const struct cmd_entry cmd_send_keys_entry = {
"send-keys", "send",
- "t:", 0, -1,
- "[-t target-pane] key ...",
+ "Rt:", 0, -1,
+ "[-R] [-t target-pane] key ...",
0,
NULL,
NULL,
@@ -44,12 +45,29 @@
struct args *args = self->args;
struct window_pane *wp;
struct session *s;
+ struct input_ctx *ictx;
const char *str;
int i, key;
if (cmd_find_pane(ctx, args_get(args, 't'), &s, &wp) == NULL)
return (-1);
+ if (args_has(args, 'R')) {
+ ictx = &wp->ictx;
+
+ memcpy(&ictx->cell, &grid_default_cell, sizeof ictx->cell);
+ memcpy(&ictx->old_cell, &ictx->cell, sizeof ictx->old_cell);
+ ictx->old_cx = 0;
+ ictx->old_cy = 0;
+
+ if (wp->mode == NULL)
+ screen_write_start(&ictx->ctx, wp, &wp->base);
+ else
+ screen_write_start(&ictx->ctx, NULL, &wp->base);
+ screen_write_reset(&ictx->ctx);
+ screen_write_stop(&ictx->ctx);
+ }
+
for (i = 0; i < args->argc; i++) {
str = args->argv[i];
Modified: trunk/input.c
===================================================================
--- trunk/input.c 2012-01-21 19:30:07 UTC (rev 2665)
+++ trunk/input.c 2012-01-21 19:31:59 UTC (rev 2666)
@@ -978,17 +978,7 @@
ictx->old_cx = 0;
ictx->old_cy = 0;
- screen_reset_tabs(sctx->s);
-
- screen_write_scrollregion(sctx, 0, screen_size_y(sctx->s) - 1);
-
- screen_write_insertmode(sctx, 0);
- screen_write_kcursormode(sctx, 0);
- screen_write_kkeypadmode(sctx, 0);
- screen_write_mousemode_off(sctx);
-
- screen_write_clearscreen(sctx);
- screen_write_cursormove(sctx, 0, 0);
+ screen_write_reset(sctx->s);
break;
case INPUT_ESC_IND:
screen_write_linefeed(sctx, 0);
Modified: trunk/screen-write.c
===================================================================
--- trunk/screen-write.c 2012-01-21 19:30:07 UTC (rev 2665)
+++ trunk/screen-write.c 2012-01-21 19:31:59 UTC (rev 2666)
@@ -46,6 +46,24 @@
{
}
+
+/* Reset screen state. */
+void
+screen_write_reset(struct screen_write_ctx *ctx)
+{
+ screen_reset_tabs(ctx->s);
+
+ screen_write_scrollregion(ctx, 0, screen_size_y(ctx->s) - 1);
+
+ screen_write_insertmode(ctx, 0);
+ screen_write_kcursormode(ctx, 0);
+ screen_write_kkeypadmode(ctx, 0);
+ screen_write_mousemode_off(ctx);
+
+ screen_write_clearscreen(ctx);
+ screen_write_cursormove(ctx, 0, 0);
+}
+
/* Write character. */
void
screen_write_putc(
Modified: trunk/tmux.1
===================================================================
--- trunk/tmux.1 2012-01-21 19:30:07 UTC (rev 2665)
+++ trunk/tmux.1 2012-01-21 19:31:59 UTC (rev 2666)
@@ -1638,6 +1638,7 @@
or
.Em emacs-copy .
.It Xo Ic send-keys
+.Fl R
.Op Fl t Ar target-pane
.Ar key Ar ...
.Xc
@@ -1652,6 +1653,9 @@
) to send; if the string is not recognised as a key, it is sent as a series of
characters.
All arguments are sent sequentially from first to last.
+The
+.Fl R
+flag causes the terminal state to be reset.
.It Ic send-prefix Op Fl t Ar target-pane
Send the prefix key to a window as if it was pressed.
If multiple prefix keys are configured, only the first is sent.
Modified: trunk/tmux.h
===================================================================
--- trunk/tmux.h 2012-01-21 19:30:07 UTC (rev 2665)
+++ trunk/tmux.h 2012-01-21 19:31:59 UTC (rev 2666)
@@ -1828,6 +1828,7 @@
void screen_write_start(
struct screen_write_ctx *, struct window_pane *, struct screen *);
void screen_write_stop(struct screen_write_ctx *);
+void screen_write_reset(struct screen_write_ctx *);
size_t printflike2 screen_write_cstrlen(int, const char *, ...);
void printflike5 screen_write_cnputs(struct screen_write_ctx *,
ssize_t, struct grid_cell *, int, const char *, ...);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs