Can you try attached please? Should fix this problem and also another
problem with pane borders that I noticed.





On Mon, Jun 22, 2020 at 10:22:01PM -0400, Kaushal Modi wrote:
>    Hello,
>    Here are the steps to reproduce the issue:
>    1. tmux -Ltest -f/dev/null new A  A  A  A A 
>    After that, the bottom left of the launched tmux session looks normal,
>    like this:
>    image.png
>    2. Then do C-b : setw pane-border-status "bottom"
>    We will see that issue right away. Notice the two "+"-like box chars to
>    the left of pane number 0.
>    image.png
> 
>    --
>    Kaushal Modi
>    On Mon, Jun 22, 2020 at 2:05 PM Nicholas Marriott
>    <[email protected]> wrote:
> 
>      Hi
> 
>      I can't reproduce - if you start tmux from nothing in a 80x24 terminal
>      (for example "tmux -Ltest -f/dev/null new"), what commands do you run to
>      reproduce the problem?
> 
>      Thanks
> 
>      On Mon, Jun 22, 2020 at 10:49:25AM -0400, Kaushal Modi wrote:
>      >A  A  Hello Nicholas,
>      >A  A  I just happened to build tmux from its master branch on git
>      yesterday as I
>      >A  A  switches OSes yesterday (from RHEL 6.8 to CentOS 7). And now I am
>      see
>      >A  A  these strange box characters at pane borders.
>      >A  A  If you visualize a tmux window split into 2x2 panes, the box
>      characters
>      >A  A  where the bottom 2 panes join look strange. See attached:
>      >A  A  image.png
>      >
>      >A  A  The box characters where all 4 panes intersect look fine though.
>      >A  A  tmux -V gives
>      >A  A  tmux next-3.2
>      >A  A  --
>      >A  A  Kaushal Modi
>      >A  A  On Mon, Jun 22, 2020 at 8:51 AM Nicholas Marriott
>      >A  A  <[email protected]> wrote:
>      >
>      >A  A  A  Hi all
>      >
>      >A  A  A  I have created the first tmux 3.2 release candidate:



-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/tmux-users/20200623073905.jgmcynfknhci3z7n%40yelena.
Index: screen-redraw.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/screen-redraw.c,v
retrieving revision 1.78
diff -u -p -r1.78 screen-redraw.c
--- screen-redraw.c     16 May 2020 16:26:34 -0000      1.78
+++ screen-redraw.c     23 Jun 2020 07:38:25 -0000
@@ -28,6 +28,8 @@ static void   screen_redraw_draw_panes(str
 static void    screen_redraw_draw_status(struct screen_redraw_ctx *);
 static void    screen_redraw_draw_pane(struct screen_redraw_ctx *,
                    struct window_pane *);
+static void    screen_redraw_set_context(struct client *,
+                   struct screen_redraw_ctx *);
 
 #define CELL_INSIDE 0
 #define CELL_LEFTRIGHT 1
@@ -251,6 +253,10 @@ screen_redraw_type_of_cell(struct client
        u_int            sx = w->sx, sy = w->sy;
        int              borders = 0;
 
+       /* Is this outside the window? */
+       if (px >= sx || py >= sy)
+               return (CELL_OUTSIDE);
+
        /*
         * Construct a bitmask of whether the cells to the left (bit 4), right,
         * top, and bottom (bit 1) of this cell are borders.
@@ -263,13 +269,16 @@ screen_redraw_type_of_cell(struct client
                if (py != 0 &&
                    screen_redraw_cell_border(c, px, py - 1, pane_status))
                        borders |= 2;
+               if (screen_redraw_cell_border(c, px, py + 1, pane_status))
+                       borders |= 1;
        } else {
                if (py == 0 ||
                    screen_redraw_cell_border(c, px, py - 1, pane_status))
-                   borders |= 2;
+                       borders |= 2;
+               if (py != sy - 1 &&
+                   screen_redraw_cell_border(c, px, py + 1, pane_status))
+                       borders |= 1;
        }
-       if (py <= sy && screen_redraw_cell_border(c, px, py + 1, pane_status))
-               borders |= 1;
 
        /*
         * Figure out what kind of border this cell is. Only one bit set
@@ -315,7 +324,7 @@ screen_redraw_check_cell(struct client *
 
        *wpp = NULL;
 
-       if (px > w->sx || py > w->sy)
+       if (px >= w->sx || py >= w->sy)
                return (CELL_OUTSIDE);
        if (px == w->sx || py == w->sy) /* window border */
                return (screen_redraw_type_of_cell(c, px, py, pane_status));
@@ -383,14 +392,16 @@ screen_redraw_check_is(u_int px, u_int p
 
 /* Update pane status. */
 static int
-screen_redraw_make_pane_status(struct client *c, struct window *w,
-    struct window_pane *wp, int pane_lines)
+screen_redraw_make_pane_status(struct client *c, struct window_pane *wp,
+    struct screen_redraw_ctx *rctx, int pane_lines)
 {
+       struct window           *w = wp->window;
        struct grid_cell         gc;
        const char              *fmt;
        struct format_tree      *ft;
        char                    *expanded;
-       u_int                    width, i;
+       int                      pane_status = rctx->pane_status;
+       u_int                    width, i, cell_type, top, px, py;
        struct screen_write_ctx  ctx;
        struct screen            old;
 
@@ -415,9 +426,20 @@ screen_redraw_make_pane_status(struct cl
 
        screen_write_start(&ctx, &wp->status_screen);
 
-       screen_redraw_border_set(wp, pane_lines, CELL_TOPBOTTOM, &gc);
-       for (i = 0; i < width; i++)
+       if (rctx->statustop)
+               top = rctx->statuslines;
+       else
+               top = 0;
+       for (i = 0; i < width; i++) {
+               px = wp->xoff + 2 + i;
+               if (rctx->pane_status == PANE_STATUS_TOP)
+                       py = top + wp->yoff - 1;
+               else
+                       py = top + wp->yoff + wp->sy;
+               cell_type = screen_redraw_type_of_cell(c, px, py, pane_status);
+               screen_redraw_border_set(wp, pane_lines, cell_type, &gc);
                screen_write_cell(&ctx, &gc);
+       }
        gc.attr &= ~GRID_ATTR_CHARSET;
 
        screen_write_cursormove(&ctx, 0, 0, 0);
@@ -504,6 +526,7 @@ screen_redraw_update(struct client *c, i
        struct window_pane      *wp;
        struct options          *wo = w->options;
        int                      redraw, lines;
+       struct screen_redraw_ctx ctx;
 
        if (c->message_string != NULL)
                redraw = status_message_redraw(c);
@@ -518,10 +541,11 @@ screen_redraw_update(struct client *c, i
                flags |= CLIENT_REDRAWOVERLAY;
 
        if (options_get_number(wo, "pane-border-status") != PANE_STATUS_OFF) {
+               screen_redraw_set_context(c, &ctx);
                lines = options_get_number(wo, "pane-border-lines");
                redraw = 0;
                TAILQ_FOREACH(wp, &w->panes, entry) {
-                       if (screen_redraw_make_pane_status(c, w, wp, lines))
+                       if (screen_redraw_make_pane_status(c, wp, &ctx, lines))
                                redraw = 1;
                }
                if (redraw)

Reply via email to