Probably it ballses up the scroll region.
Can you try this and then see if send-keys -R fixes it:
Index: cmd-send-keys.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/cmd-send-keys.c,v
retrieving revision 1.8
diff -u -p -r1.8 cmd-send-keys.c
--- cmd-send-keys.c 23 May 2010 19:42:19 -0000 1.8
+++ cmd-send-keys.c 23 Dec 2010 20:35:55 -0000
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <stdlib.h>
+#include <string.h>
#include "tmux.h"
@@ -35,11 +36,12 @@ struct cmd_send_keys_data {
char *target;
u_int nkeys;
int *keys;
+ int flag_reset;
};
const struct cmd_entry cmd_send_keys_entry = {
"send-keys", "send",
- "[-t target-pane] key ...",
+ "[-R] [-t target-pane] key ...",
0, "",
NULL,
cmd_send_keys_parse,
@@ -59,9 +61,13 @@ cmd_send_keys_parse(struct cmd *self, in
data->target = NULL;
data->nkeys = 0;
data->keys = NULL;
+ data->flag_reset = 0;
- while ((opt = getopt(argc, argv, "t:")) != -1) {
+ while ((opt = getopt(argc, argv, "Rt:")) != -1) {
switch (opt) {
+ case 'R':
+ data->flag_reset = 1;
+ break;
case 't':
if (data->target == NULL)
data->target = xstrdup(optarg);
@@ -72,8 +78,6 @@ cmd_send_keys_parse(struct cmd *self, in
}
argc -= optind;
argv += optind;
- if (argc == 0)
- goto usage;
while (argc-- != 0) {
if ((key = key_string_lookup_string(*argv)) != KEYC_NONE) {
@@ -106,6 +110,7 @@ cmd_send_keys_exec(struct cmd *self, str
struct cmd_send_keys_data *data = self->data;
struct window_pane *wp;
struct session *s;
+ struct input_ctx *ictx;
u_int i;
if (data == NULL)
@@ -113,6 +118,22 @@ cmd_send_keys_exec(struct cmd *self, str
if (cmd_find_pane(ctx, data->target, &s, &wp) == NULL)
return (-1);
+
+ if (data->flag_reset) {
+ 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 < data->nkeys; i++)
window_pane_key(wp, s, data->keys[i]);
Index: input.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/input.c,v
retrieving revision 1.31
diff -u -p -r1.31 input.c
--- input.c 23 Dec 2010 20:18:39 -0000 1.31
+++ input.c 23 Dec 2010 20:35:56 -0000
@@ -946,17 +946,7 @@ input_esc_dispatch(struct input_ctx *ict
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(sctx, 0);
-
- screen_write_clearscreen(sctx);
- screen_write_cursormove(sctx, 0, 0);
+ screen_write_reset(sctx);
break;
case INPUT_ESC_IND:
screen_write_linefeed(sctx, 0);
Index: screen-write.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/screen-write.c,v
retrieving revision 1.43
diff -u -p -r1.43 screen-write.c
--- screen-write.c 21 Jun 2010 00:11:12 -0000 1.43
+++ screen-write.c 23 Dec 2010 20:35:56 -0000
@@ -46,6 +46,24 @@ screen_write_stop(unused struct screen_w
{
}
+
+/* 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(ctx, 0);
+
+ screen_write_clearscreen(ctx);
+ screen_write_cursormove(ctx, 0, 0);
+}
+
/* Write character. */
void
screen_write_putc(
Index: tmux.1
===================================================================
RCS file: /cvs/src/usr.bin/tmux/tmux.1,v
retrieving revision 1.195
diff -u -p -r1.195 tmux.1
--- tmux.1 19 Dec 2010 18:35:08 -0000 1.195
+++ tmux.1 23 Dec 2010 20:35:58 -0000
@@ -1465,6 +1465,7 @@ are listed; this may be one of:
or
.Em emacs-copy .
.It Xo Ic send-keys
+.Fl R
.Op Fl t Ar target-pane
.Ar key Ar ...
.Xc
@@ -1479,6 +1480,9 @@ or
) 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.
Index: tmux.h
===================================================================
RCS file: /cvs/src/usr.bin/tmux/tmux.h,v
retrieving revision 1.254
diff -u -p -r1.254 tmux.h
--- tmux.h 21 Dec 2010 22:37:59 -0000 1.254
+++ tmux.h 23 Dec 2010 20:35:59 -0000
@@ -1774,6 +1774,7 @@ char *grid_view_string_cells(struct grid
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 *, ...);
On Thu, Dec 23, 2010 at 04:37:06PM -0500, Dan Tulovsky wrote:
> I can reproduce this every time. We use Cyclades serial console
> appliances (http://www.avocent.com/). If I connect to one, and then
> do a reboot of the Linux server I am controlling, the terminal gets
> into the weird state I described above. It happens with plain
> Terminal on the Mac, as well as iTerm. It happened with screen (C-a Z
> fixed the terminal in screen). In the Mac Terminal program, <cmd>+R
> fixes the terminal.
>
> So I don't think it's a bug.. I think the Dell servers send some odd
> output to the serial port which puts the terminal into this state.
> But also, catting a binary file will occasionally require a reset.
> (Not that I do that very often...)
>
> dan
>
> On Thu, Dec 23, 2010 at 3:25 PM, Nicholas Marriott
> <[email protected]> wrote:
> > How are you getting the terminal into a state that needs a reset?
> >
> > If tmux's internal state is bad it is probably a bug.
> >
> >
> > On Thu, Dec 23, 2010 at 01:49:42PM -0500, Dan Tulovsky wrote:
> >> I mean the terminal inside tmux. And yes, what I am looking for is
> >> the tmux equivalent of screen's C-a Z.
> >>
> >> thanks
> >> dan
> >>
> >> On Tue, Dec 21, 2010 at 3:56 PM, Nicholas Marriott
> >> <[email protected]> wrote:
> >> > Do you mean the terminal inside or outside tmux?
> >> >
> >> > If you mean outside: detach tmux, run reset(1)/stty sane and reattach.
> >> >
> >> > There is no reason we couldn't have a command (or an argument to
> >> > refresh-client) to output rs0 etc but frankly reset(1) generally does a
> >> > better job of it.
> >> >
> >> >
> >> > On Tue, Dec 21, 2010 at 03:26:02PM -0500, Dan Tulovsky wrote:
> >> >> Hmm.. so I mapped it back to the default, but it doesn't actually
> >> >> work. As far as I can tell, nothing happens. The currently broken
> >> >> terminal (after a reboot via serial console of the remote server) is
> >> >> not scrolling. All output is on the very last line and stays there.
> >> >>
> >> >> C-b ? shows
> >> >>
> >> >> r: refresh-client
> >> >>
> >> >> I've also tried typing it in as a command:
> >> >>
> >> >> C-b :
> >> >>
> >> >> : refresh-client
> >> >>
> >> >> same story.
> >> >>
> >> >> any ideas?
> >> >>
> >> >> dan
> >> >>
> >> >> On Tue, Dec 21, 2010 at 3:07 PM, Dan Tulovsky <[email protected]> wrote:
> >> >> > Well I'll be.. having this:
> >> >> >
> >> >> > bind r source-file ~/.tmux.conf
> >> >> >
> >> >> > sorta breaks that. :)
> >> >> >
> >> >> > thanks much
> >> >> > dan
> >> >> >
> >> >> > On Tue, Dec 21, 2010 at 3:00 PM, Micah Cowan <[email protected]> wrote:
> >> >> >> (12/21/2010 11:27 AM), Dan Tulovsky wrote:
> >> >> >>> Is there a way to send a Reset in tmux? Sometimes (for example,
> >> >> >>> when
> >> >> >>> using serial consoles) the terminal gets screwed up and the only way
> >> >> >>> to fix it is to reset it.
> >> >> >>>
> >> >> >>> This is <cmd>+R in Terminal on the Mac. I think it's just C-a r in
> >> >> >>> screen.
> >> >> >>
> >> >> >> Default binding is <prefix> r in tmux as well (see the manpage for
> >> >> >> "refresh-client").
> >> >> >>
> >> >> >> --
> >> >> >> Micah J. Cowan
> >> >> >> http://micah.cowan.name/
> >> >> >>
> >> >> >
> >> >>
> >> >> ------------------------------------------------------------------------------
> >> >> Forrester recently released a report on the Return on Investment (ROI)
> >> >> of
> >> >> Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
> >> >> within 7 months. Over 3 million businesses have gone Google with
> >> >> Google Apps:
> >> >> an online email calendar, and document program that's accessible from
> >> >> your
> >> >> browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
> >> >> _______________________________________________
> >> >> tmux-users mailing list
> >> >> [email protected]
> >> >> https://lists.sourceforge.net/lists/listinfo/tmux-users
> >> >
> >
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users