Sweet, thanks!
I think it works to append lines to the end of the scroll buffer both for
regular shells and for full-screen commands.
('split-window "info make"' is what I used for a full-screen example).
What do you think about this patch (goes on top of yours):
diff --git a/trunk/server-fn.c b/trunk/server-fn.c
index 07c56ab..999f9ac 100644
--- a/trunk/server-fn.c
+++ b/trunk/server-fn.c
@@ -345,13 +345,21 @@ server_destroy_pane(struct window_pane *wp)
if (old_fd == -1)
return;
screen_write_start(&ctx, wp, &wp->base);
+ /* move to bottom */
+ screen_write_cursormove(&ctx, 0, screen_size_y(ctx.s) - 1);
+ /* draw blank lines below the last line on screen */
+ screen_write_linefeed(&ctx, 1);
+ screen_write_linefeed(&ctx, 1);
+ screen_write_linefeed(&ctx, 1);
+ /* scroll up to preserve last screen */
screen_write_scrollregion(&ctx, 0, screen_size_y(ctx.s) - 1);
- screen_write_cursormove(&ctx, 0, 0);
- screen_write_insertline(&ctx, 2);
- screen_write_cursormove(&ctx, 0, 0);
+ /* move to middle line to write message */
+ screen_write_cursormove(&ctx, 0, screen_size_y(ctx.s) - 2);
memcpy(&gc, &grid_default_cell, sizeof gc);
gc.attr |= GRID_ATTR_BRIGHT;
- screen_write_nputs(&ctx, -1, &gc, 0, "Pane is dead");
+ screen_write_nputs(&ctx, -1, &gc, 0, "Pane is dead. "
+ "Use 'respawn-pane' to reactivate "
+ "or 'kill-pane' to remove.");
screen_write_stop(&ctx);
wp->flags |= PANE_REDRAW;
return;
feel free to clean it up as necessary ;-)
On Tue, Aug 30, 2011 at 8:38 AM, Nicholas Marriott <
nicholas.marri...@gmail.com> wrote:
>
> Move cursor to the very bottom (screen_size_y(s) - 1) and call
> screen_write_linefeed to scroll, it will move the top line into the
> history.
>
>
>
> On Tue, Aug 30, 2011 at 08:29:20AM -0700, Randy Stauner wrote:
> > Ah, yes, those are good points.
> > I did realize that I need to disconnect from tmux in order to stop the
> > server... that's why my changes had no effect.
> > I'm sure I've been bitten by that before.
> > Perhaps I'll toy with it a little more.
> > Is there a way to add lines to the bottom of the scroll buffer?
> > I see that scrollregion and cursormove functions won't let you scroll
> past
> > the last line (which makes sense)...
> > so is there a way to add lines to what is in the scrollback buffer so
> that
> > it could scroll farther
> > (for example add 2 blank lines to the end so that i can scroll down
> past
> > whatever was previously on the screen)?
> > It would be great to not overwrite what's already on the screen.
> > Commenting out the scrollregion and cursormove commands makes it write
> at
> > the cursor position
> > (which might be after (or in the middle of)) any command I had typed
> but
> > not entered at the command prompt).
> > This doesn't seem too bad to me, but does make it seem "unpolished"
> and
> > I'm sure some wouldn't like it.
> > On Tue, Aug 30, 2011 at 8:14 AM, Nicholas Marriott
> > <[1]nicholas.marri...@gmail.com> wrote:
> >
> > Putting it at the bottom is harder, because where is the bottom? If
> > you're running a full screen program the bottom is the very bottom.
> But
> > if you have a clear screen with just eg 1 shell prompt on then the
> > bottom needs to be line 2 or so.
> >
> > We can always put it at the very bottom of the screen but then if
> you
> > only have a few lines on screen you will lose them.
> > On Tue, Aug 30, 2011 at 08:01:08AM -0700, Randy Stauner wrote:
> > > ** **-- (sorry, didn't mean to send this directly instead of to
> the
> > list) --
> > > ** **I don't use automatic rename in that session because of the
> large
> > layout
> > > ** **with many windows and ssh connections.
> > > ** **This patch works nicely for me, thanks.
> > > ** **While this does serve the purpose,
> > > ** **I think it might be nicer/more intuitive to have the message
> at
> > the bottom
> > > ** **(since that is where you typically expect the next thing).
> > > ** **The way that it scrolls backward confuses me a bit since i
> lose
> > the last
> > > ** **line or two from the last command output.
> > > ** **Would it be difficult to print at the bottom instead of the
> top
> > (without
> > > ** **scrolling backward (scrolling forward would be ok))?
> > > ** **I tried toying with it myself for a bit,**but when changing
> the
> > numbers
> > > ** **passed to screen_write_scrollregion and
> screen_write_cursormove
> > seemed to
> > > ** **have no effect I accepted that I was far out of my element
> and I
> > should
> > > ** **defer to the master (plus I gotta get back to work).
> > > ** **But thanks for the quick response thus far! **I will use
> this.
> > >
> > > ** **On Tue, Aug 30, 2011 at 2:55 AM, Nicholas Marriott
> > > ** **<[1][2]nicholas.marri...@gmail.com> wrote:
> > >
> > > ** ** **In fact, try this:
> > >
> > > ** ** **Index: server-fn.c
> > > ** **
> >
> **===================================================================
> > > ** ** **RCS file: /cvs/src/usr.bin/tmux/server-fn.c,v
> > > ** ** **retrieving revision 1.50
> > > ** ** **diff -u -p -r1.50 server-fn.c
> > > ** ** **--- server-fn.c 23 Jan 2011 11:03:43 -0000 ** ** **1.50
> > > ** ** **+++ server-fn.c 30 Aug 2011 09:54:49 -0000
> > > ** ** **@@ -329,16 +329,33 @@ server_unlink_window(struct session
> *s,
> > > ** ** ****void
> > > ** ** ****server_destroy_pane(struct window_pane *wp)
> > > ** ** ****{
> > > ** ** **- ** ** ** struct window ** *w = wp->window;
> > > ** ** **+ ** ** ** struct window ** ** ** ** ** *w = wp->window;
> > > ** ** **+ ** ** ** int ** ** ** ** ** ** ** ** ** ** **old_fd;
> > > ** ** **+ ** ** ** struct screen_write_ctx **ctx;
> > > ** ** **+ ** ** ** struct grid_cell ** ** ** ** gc;
> > >
> > > ** ** **+ ** ** ** old_fd = wp->fd;
> > > ** ** **** ** ** **if (wp->fd != -1) {
> > > ** ** **** ** ** ** ** ** ** **close(wp->fd);
> > > ** ** **** ** ** ** ** ** ** **bufferevent_free(wp->event);
> > > ** ** **** ** ** ** ** ** ** **wp->fd = -1;
> > > ** ** **** ** ** **}
> > >
> > > ** ** **- ** ** ** if (options_get_number(&w->options,
> > "remain-on-exit"))
> > > ** ** **+ ** ** ** if (options_get_number(&w->options,
> > "remain-on-exit")) {
> > > ** ** **+ ** ** ** ** ** ** ** if (old_fd == -1)
> > > ** ** **+ ** ** ** ** ** ** ** ** ** ** ** return;
> > > ** ** **+ ** ** ** ** ** ** ** screen_write_start(&ctx, wp,
> > &wp->base);
> > > ** ** **+ ** ** ** ** ** ** ** screen_write_scrollregion(&ctx, 0,
> > > ** ** **screen_size_y(ctx.s) - 1);
> > > ** ** **+ ** ** ** ** ** ** ** screen_write_cursormove(&ctx, 0,
> 0);
> > > ** ** **+ ** ** ** ** ** ** ** screen_write_insertline(&ctx, 2);
> > > ** ** **+ ** ** ** ** ** ** ** screen_write_cursormove(&ctx, 0,
> 0);
> > > ** ** **+ ** ** ** ** ** ** ** memcpy(&gc, &grid_default_cell,
> sizeof
> > gc);
> > > ** ** **+ ** ** ** ** ** ** ** gc.attr |= GRID_ATTR_BRIGHT;
> > > ** ** **+ ** ** ** ** ** ** ** screen_write_nputs(&ctx, -1, &gc,
> 0,
> > "Pane is
> > > ** ** **dead");
> > > ** ** **+ ** ** ** ** ** ** ** screen_write_stop(&ctx);
> > > ** ** **+ ** ** ** ** ** ** ** wp->flags |= PANE_REDRAW;
> > > ** ** **** ** ** ** ** ** ** **return;
> > > ** ** **+ ** ** ** }
> > >
> > > ** ** **** ** ** **layout_close_pane(wp);
> > > ** ** **** ** ** **window_remove_pane(w, wp);
> > >
> > > ** ** **On Tue, Aug 30, 2011 at 10:22:46AM +0100, Nicholas
> Marriott
> > wrote:
> > > ** ** **> Hi
> > > ** ** **>
> > > ** ** **> If you have automatic rename on it will rename the
> window to
> > add
> > > ** ** **[dead]
> > > ** ** **> but yes printing that in the pane wouldn't do any harm,
> I'll
> > add it to
> > > ** ** **> the todo list.
> > > ** ** **>
> > > ** ** **>
> > > ** ** **> On Mon, Aug 29, 2011 at 10:15:12AM -0700, Randy Stauner
> > wrote:
> > > ** ** **> > ** **My ssh connection died and it looked to me like
> the
> > process
> > > ** ** **hung.
> > > ** ** **> > ** **Turns out I had remain-on-exit set but I did that
> so
> > long ago I
> > > ** ** **forgot
> > > ** ** **> > ** **about it.
> > > ** ** **> > ** **It would be nice to have some sort of
> notification
> > that this
> > > ** ** **pane is dead
> > > ** ** **> > ** **and you likely either want to kill it or respawn
> it.
> > > ** ** **> > ** **A window flag might be nice, though a message in
> the
> > pane would
> > > ** ** **be a lot
> > > ** ** **> > ** **more visible.
> > > ** ** **> > ** **I try not to offend by comparing tmux to screen,
> > > ** ** **> > ** **but screen used to show a message like "This
> window
> > is dead,
> > > ** ** **press 1 to
> > > ** ** **> > ** **respawn or 0 to kill"
> > > ** ** **> > ** **or something like that.
> > > ** ** **> > ** **Thankfully I've been happily using tmux for so
> long i
> > don't
> > > ** ** **remember
> > > ** ** **> > ** **exactly how screen used to do it.
> > > ** ** **> > ** **I tried looking at a few of the .c files but I
> wasn't
> > really
> > > ** ** **sure where to
> > > ** ** **> > ** **begin trying to put something like that,
> > > ** ** **> > ** **so I thought I'd just mention it as a feature
> > request.
> > > ** ** **> > ** **I think a nice message at the end of the pane
> would
> > be very
> > > ** ** **helpful to
> > > ** ** **> > ** **remind me why my terminal is now stuck.
> > > ** ** **> > ** **The only reason i use remain-on-exit is to keep
> my
> > window
> > > ** ** **layout (numbers,
> > > ** ** **> > ** **names, ssh connections, etc).
> > > ** ** **> > ** **Now having taken the time to write this perhaps
> I'll
> > remember
> > > ** ** **next time i
> > > ** ** **> > ** **see it.
> > > ** ** **> > ** **Thanks for tmux, it sure is nice.
> > > ** ** **> > ** **- Randy
> > > ** ** **>
> > > ** ** **> >
> > > ** **
> >
>
> **------------------------------------------------------------------------------
> > > ** ** **> > EMC VNX: the world's simplest storage, starting under
> $10K
> > > ** ** **> > The only unified storage solution that offers unified
> > management
> > > ** ** **> > Up to 160% more powerful than alternatives and 25%
> more
> > efficient.
> > > ** ** **> > Guaranteed. [2][3]http://p.sf.net/sfu/emc-vnx-dev2dev
> > > ** ** **>
> > > ** ** **> > _______________________________________________
> > > ** ** **> > tmux-users mailing list
> > > ** ** **> > [3][4]tmux-users@lists.sourceforge.net
> > > ** ** **> >
> > [4][5]https://lists.sourceforge.net/lists/listinfo/tmux-users
> > > ** ** **>
> > > ** ** **>
> > > ** ** **>
> > > ** **
> >
>
> **------------------------------------------------------------------------------
> > > ** ** **> Special Offer -- Download ArcSight Logger for FREE!
> > > ** ** **> Finally, a world-class log management solution at an
> even
> > better
> > > ** ** **> price-free! And you'll get a free "Love Thy Logs"
> t-shirt
> > when you
> > > ** ** **> download Logger. Secure your free ArcSight Logger TODAY!
> > > ** ** **> [5][6]http://p.sf.net/sfu/arcsisghtdev2dev
> > > ** ** **> _______________________________________________
> > > ** ** **> tmux-users mailing list
> > > ** ** **> [6][7]tmux-users@lists.sourceforge.net
> > > ** ** **>
> > [7][8]https://lists.sourceforge.net/lists/listinfo/tmux-users
> > >
> > > References
> > >
> > > ** **Visible links
> > > ** **1. mailto:[9]nicholas.marri...@gmail.com
> > > ** **2. [10]http://p.sf.net/sfu/emc-vnx-dev2dev
> > > ** **3. mailto:[11]tmux-users@lists.sourceforge.net
> > > ** **4. [12]
> https://lists.sourceforge.net/lists/listinfo/tmux-users
> > > ** **5. [13]http://p.sf.net/sfu/arcsisghtdev2dev
> > > ** **6. mailto:[14]tmux-users@lists.sourceforge.net
> > > ** **7. [15]
> https://lists.sourceforge.net/lists/listinfo/tmux-users
> > >
> >
>
> ------------------------------------------------------------------------------
> > > Special Offer -- Download ArcSight Logger for FREE!
> > > Finally, a world-class log management solution at an even better
> > > price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> > > download Logger. Secure your free ArcSight Logger TODAY!
> > > [16]http://p.sf.net/sfu/arcsisghtdev2dev
> >
> > > _______________________________________________
> > > tmux-users mailing list
> > > [17]tmux-users@lists.sourceforge.net
> > > [18]https://lists.sourceforge.net/lists/listinfo/tmux-users
> >
> > References
> >
> > Visible links
> > 1. mailto:nicholas.marri...@gmail.com
> > 2. mailto:nicholas.marri...@gmail.com
> > 3. http://p.sf.net/sfu/emc-vnx-dev2dev
> > 4. mailto:tmux-users@lists.sourceforge.net
> > 5. https://lists.sourceforge.net/lists/listinfo/tmux-users
> > 6. http://p.sf.net/sfu/arcsisghtdev2dev
> > 7. mailto:tmux-users@lists.sourceforge.net
> > 8. https://lists.sourceforge.net/lists/listinfo/tmux-users
> > 9. mailto:nicholas.marri...@gmail.com
> > 10. http://p.sf.net/sfu/emc-vnx-dev2dev
> > 11. mailto:tmux-users@lists.sourceforge.net
> > 12. https://lists.sourceforge.net/lists/listinfo/tmux-users
> > 13. http://p.sf.net/sfu/arcsisghtdev2dev
> > 14. mailto:tmux-users@lists.sourceforge.net
> > 15. https://lists.sourceforge.net/lists/listinfo/tmux-users
> > 16. http://p.sf.net/sfu/arcsisghtdev2dev
> > 17. mailto:tmux-users@lists.sourceforge.net
> > 18. https://lists.sourceforge.net/lists/listinfo/tmux-users
>
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users