Usually simpler is better ;-)
I think this is great!
Thanks!
(reposted to list after cutting off bottom to meet size limits.)
On Wed, Aug 31, 2011 at 12:13 AM, Nicholas Marriott <
nicholas.marri...@gmail.com> wrote:
> You need to reset the scroll region before you write line feeds or it'll
> not scroll if the scroll region is set.
>
> Also I don't like so much text, you can't get this without setting
> remain-on-exit and what you can do with the pane after than can be found
> by looking in the manpage.
>
> How about just 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 31 Aug 2011 07:12:01 -0000
> @@ -329,16 +329,32 @@ 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, screen_size_y(ctx.s) - 1);
> + screen_write_linefeed(&ctx, 1);
> + memcpy(&gc, &grid_default_cell, sizeof gc);
> + gc.attr |= GRID_ATTR_BRIGHT;
> + screen_write_puts(&ctx, &gc, "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 09:39:34PM -0700, Randy Stauner wrote:
> > 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
> > <[1]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.
> >
>
------------------------------------------------------------------------------
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