From f6095cad993293ec0f1988c1f6ae22921f9d2b2e Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 7 Dec 2020 09:46:58 +0000 Subject: Do not include the status line size when working out the character for the pane status line. GitHub issue 2493. --- screen-redraw.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'screen-redraw.c') diff --git a/screen-redraw.c b/screen-redraw.c index 50df2671..47c1a838 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -407,7 +407,7 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp, struct format_tree *ft; char *expanded; int pane_status = rctx->pane_status; - u_int width, i, cell_type, top, px, py; + u_int width, i, cell_type, px, py; struct screen_write_ctx ctx; struct screen old; @@ -432,16 +432,12 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp, screen_write_start(&ctx, &wp->status_screen); - 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; + py = wp->yoff - 1; else - py = top + wp->yoff + wp->sy; + py = 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); -- cgit From 3dddc11603b1bd66b5586b47795716e87921a096 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 5 Feb 2021 12:29:18 +0000 Subject: Send Unicode directional isolate characters around horizontal pane borders if the terminal support UTF-8 and an extension terminfo(5) capability "Bidi" is present. On terminals with BiDi support (ie, VTE) this seems to be enough to display right-to-left text acceptably enough to be usable (with some caveats about the mouse position). Requested by and with help from Mahmoud Elagdar in GitHub issue 2425. --- screen-redraw.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'screen-redraw.c') diff --git a/screen-redraw.c b/screen-redraw.c index 47c1a838..6ddabc52 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -32,8 +32,8 @@ static void screen_redraw_set_context(struct client *, struct screen_redraw_ctx *); #define CELL_INSIDE 0 -#define CELL_LEFTRIGHT 1 -#define CELL_TOPBOTTOM 2 +#define CELL_TOPBOTTOM 1 +#define CELL_LEFTRIGHT 2 #define CELL_TOPLEFT 3 #define CELL_TOPRIGHT 4 #define CELL_BOTTOMLEFT 5 @@ -47,6 +47,9 @@ static void screen_redraw_set_context(struct client *, #define CELL_BORDERS " xqlkmjwvtun~" +#define START_ISOLATE "\342\201\246" +#define END_ISOLATE "\342\201\251" + static const struct utf8_data screen_redraw_double_borders[] = { { "", 0, 0, 0 }, { "\342\225\221", 0, 3, 1 }, /* U+2551 */ @@ -299,7 +302,7 @@ screen_redraw_type_of_cell(struct client *c, u_int px, u_int py, case 13: /* 1101, left right bottom */ return (CELL_TOPJOIN); case 12: /* 1100, left right */ - return (CELL_TOPBOTTOM); + return (CELL_LEFTRIGHT); case 11: /* 1011, left top bottom */ return (CELL_RIGHTJOIN); case 10: /* 1010, left top */ @@ -313,7 +316,7 @@ screen_redraw_type_of_cell(struct client *c, u_int px, u_int py, case 5: /* 0101, right bottom */ return (CELL_TOPLEFT); case 3: /* 0011, top bottom */ - return (CELL_LEFTRIGHT); + return (CELL_TOPBOTTOM); } return (CELL_OUTSIDE); } @@ -680,7 +683,7 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j) struct tty *tty = &c->tty; struct window_pane *wp; u_int cell_type, x = ctx->ox + i, y = ctx->oy + j; - int pane_status = ctx->pane_status; + int pane_status = ctx->pane_status, isolates; struct grid_cell gc; const struct grid_cell *tmp; @@ -705,11 +708,22 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j) } screen_redraw_border_set(wp, ctx->pane_lines, cell_type, &gc); + if (cell_type == CELL_TOPBOTTOM && + (c->flags & CLIENT_UTF8) && + tty_term_has(tty->term, TTYC_BIDI)) + isolates = 1; + else + isolates = 0; + if (ctx->statustop) tty_cursor(tty, i, ctx->statuslines + j); else tty_cursor(tty, i, j); + if (isolates) + tty_puts(tty, END_ISOLATE); tty_cell(tty, &gc, &grid_default_cell, NULL); + if (isolates) + tty_puts(tty, START_ISOLATE); } /* Draw the borders. */ -- cgit