From 019b75284f80dc7a242fb7898a18b791b14716af Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 25 Sep 2018 14:27:21 +0000 Subject: Allow panes to be 1 line or column by redrawing instead of using the scroll region, from Soeren Tempel in GitHub issue 1487. --- usr.bin/tmux/tmux.h | 9 +++------ usr.bin/tmux/tty.c | 22 ++++++++++++++++------ usr.bin/tmux/window-copy.c | 4 ++-- 3 files changed, 21 insertions(+), 14 deletions(-) (limited to 'usr.bin/tmux') diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 02ed0f287f2..3c348b1fb29 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.845 2018/08/29 09:50:32 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.846 2018/09/25 14:27:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -59,11 +59,8 @@ struct tmuxproc; /* Default global configuration file. */ #define TMUX_CONF "/etc/tmux.conf" -/* - * Minimum layout cell size, NOT including separator line. The scroll region - * cannot be one line in height so this must be at least two. - */ -#define PANE_MINIMUM 2 +/* Minimum layout cell size, NOT including border lines. */ +#define PANE_MINIMUM 1 /* Automatic name refresh interval, in microseconds. Must be < 1 second. */ #define NAME_INTERVAL 500000 diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 1fb1551de9a..754614b27de 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.306 2018/09/11 17:31:01 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.307 2018/09/25 14:27:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1145,7 +1145,9 @@ tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx) if (!tty_pane_full_width(tty, ctx) || tty_fake_bce(tty, ctx->wp, ctx->bg) || !tty_term_has(tty->term, TTYC_CSR) || - !tty_term_has(tty->term, TTYC_IL1)) { + !tty_term_has(tty->term, TTYC_IL1) || + ctx->wp->sx == 1 || + ctx->wp->sy == 1) { tty_redraw_region(tty, ctx); return; } @@ -1166,7 +1168,9 @@ tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx) if (!tty_pane_full_width(tty, ctx) || tty_fake_bce(tty, ctx->wp, ctx->bg) || !tty_term_has(tty->term, TTYC_CSR) || - !tty_term_has(tty->term, TTYC_DL1)) { + !tty_term_has(tty->term, TTYC_DL1) || + ctx->wp->sx == 1 || + ctx->wp->sy == 1) { tty_redraw_region(tty, ctx); return; } @@ -1227,7 +1231,9 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx) if (!tty_pane_full_width(tty, ctx) || tty_fake_bce(tty, wp, 8) || !tty_term_has(tty->term, TTYC_CSR) || - !tty_term_has(tty->term, TTYC_RI)) { + !tty_term_has(tty->term, TTYC_RI) || + ctx->wp->sx == 1 || + ctx->wp->sy == 1) { tty_redraw_region(tty, ctx); return; } @@ -1251,7 +1257,9 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) if ((!tty_pane_full_width(tty, ctx) && !tty_use_margin(tty)) || tty_fake_bce(tty, wp, 8) || - !tty_term_has(tty->term, TTYC_CSR)) { + !tty_term_has(tty->term, TTYC_CSR) || + wp->sx == 1 || + wp->sy == 1) { tty_redraw_region(tty, ctx); return; } @@ -1287,7 +1295,9 @@ tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx) if ((!tty_pane_full_width(tty, ctx) && !tty_use_margin(tty)) || tty_fake_bce(tty, wp, 8) || - !tty_term_has(tty->term, TTYC_CSR)) { + !tty_term_has(tty->term, TTYC_CSR) || + wp->sx == 1 || + wp->sy == 1) { tty_redraw_region(tty, ctx); return; } diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 9ddfd9a1a19..6b05f5896e3 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.200 2018/09/10 06:48:01 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.201 2018/09/25 14:27:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1299,7 +1299,7 @@ window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, style_apply(&gc, oo, "mode-style"); gc.flags |= GRID_FLAG_NOPALETTE; - if (py == 0) { + if (py == 0 && s->rupper < s->rlower) { if (data->searchmark == NULL) { size = xsnprintf(hdr, sizeof hdr, "[%u/%u]", data->oy, screen_hsize(data->backing)); -- cgit v1.2.3