diff --git a/cmd-display-panes.c b/cmd-display-panes.c index 25556f3d..cd688081 100644 --- a/cmd-display-panes.c +++ b/cmd-display-panes.c @@ -70,10 +70,10 @@ cmd_display_panes_draw_pane(struct screen_redraw_ctx *ctx, char buf[16], lbuf[16], rbuf[16], *ptr; size_t len, llen, rlen; - if (wp->xoff + wp->sx <= ctx->ox || - wp->xoff >= ctx->ox + ctx->sx || - wp->yoff + wp->sy <= ctx->oy || - wp->yoff >= ctx->oy + ctx->sy) + if (wp->xoff + (int)wp->sx <= ctx->ox || + wp->xoff >= ctx->ox + (int)ctx->sx || + wp->yoff + (int)wp->sy <= ctx->oy || + wp->yoff >= ctx->oy + (int)ctx->sy) return; if (wp->xoff >= ctx->ox && wp->xoff + wp->sx <= ctx->ox + ctx->sx) { diff --git a/cmd.c b/cmd.c index 2e553a7c..d72d0c5f 100644 --- a/cmd.c +++ b/cmd.c @@ -774,9 +774,9 @@ cmd_mouse_at(struct window_pane *wp, struct mouse_event *m, u_int *xp, if (m->statusat == 0 && y >= m->statuslines) y -= m->statuslines; - if (x < wp->xoff || x >= wp->xoff + wp->sx) + if ((int)x < wp->xoff || (int)x >= wp->xoff + (int)wp->sx) return (-1); - if (y < wp->yoff || y >= wp->yoff + wp->sy) + if ((int)y < wp->yoff || (int)y >= wp->yoff + (int)wp->sy) return (-1); if (xp != NULL) diff --git a/screen-redraw.c b/screen-redraw.c index c896340a..933c5fbc 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -122,7 +122,7 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp, u_int px, u_int py) { struct options *oo = wp->window->options; - u_int ex = wp->xoff + wp->sx, ey = wp->yoff + wp->sy; + int ex = wp->xoff + wp->sx, ey = wp->yoff + wp->sy; int hsplit = 0, vsplit = 0, pane_status = ctx->pane_status; int pane_scrollbars = ctx->pane_scrollbars, sb_w = 0; int sb_pos; @@ -133,7 +133,8 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp, sb_pos = 0; /* Inside pane. */ - if (px >= wp->xoff && px < ex && py >= wp->yoff && py < ey) + if ((int)px >= wp->xoff && (int)px < ex && + (int)py >= wp->yoff && (int)py < ey) return (SCREEN_REDRAW_INSIDE); /* Get pane indicator. */ @@ -153,16 +154,17 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp, * Left/right borders. The wp->sy / 2 test is to colour only half the * active window's border when there are two panes. */ - if ((wp->yoff == 0 || py >= wp->yoff - 1) && py <= ey) { + if ((wp->yoff == 0 || (int)py >= wp->yoff - 1) && (int)py <= ey) { if (sb_pos == PANE_SCROLLBARS_LEFT) { if (wp->xoff - sb_w == 0 && px == wp->sx + sb_w) if (!hsplit || (hsplit && py <= wp->sy / 2)) return (SCREEN_REDRAW_BORDER_RIGHT); if (wp->xoff - sb_w != 0) { - if (px == wp->xoff - sb_w - 1 && + if ((int)px == wp->xoff - sb_w - 1 && (!hsplit || (hsplit && py > wp->sy / 2))) return (SCREEN_REDRAW_BORDER_LEFT); - if (px == wp->xoff + wp->sx + sb_w - 1) + if ((int)px == wp->xoff + + (int)wp->sx + sb_w - 1) return (SCREEN_REDRAW_BORDER_RIGHT); } } else { /* sb_pos == PANE_SCROLLBARS_RIGHT or disabled */ @@ -170,7 +172,7 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp, if (!hsplit || (hsplit && py <= wp->sy / 2)) return (SCREEN_REDRAW_BORDER_RIGHT); if (wp->xoff != 0) { - if (px == wp->xoff - 1 && + if ((int)px == wp->xoff - 1 && (!hsplit || (hsplit && py > wp->sy / 2))) return (SCREEN_REDRAW_BORDER_LEFT); if (px == wp->xoff + wp->sx + sb_w) @@ -183,25 +185,29 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp, if (vsplit && pane_status == PANE_STATUS_OFF && sb_w == 0) { if (wp->yoff == 0 && py == wp->sy && px <= wp->sx / 2) return (SCREEN_REDRAW_BORDER_BOTTOM); - if (wp->yoff != 0 && py == wp->yoff - 1 && px > wp->sx / 2) + if (wp->yoff != 0 && (int)py == wp->yoff - 1 && px > wp->sx / 2) return (SCREEN_REDRAW_BORDER_TOP); } else { if (sb_pos == PANE_SCROLLBARS_LEFT) { - if ((wp->xoff - sb_w == 0 || px >= wp->xoff - sb_w) && - (px <= ex || (sb_w != 0 && px < ex + sb_w))) { - if (wp->yoff != 0 && py == wp->yoff - 1) + if ((wp->xoff - sb_w == 0 || + (int)px >= wp->xoff - sb_w) && + ((int)px <= ex || (sb_w != 0 && + (int)px < ex + sb_w))) { + if (wp->yoff != 0 && (int)py == wp->yoff - 1) return (SCREEN_REDRAW_BORDER_TOP); - if (py == ey) + if ((int)py == ey) return (SCREEN_REDRAW_BORDER_BOTTOM); } } else { /* sb_pos == PANE_SCROLLBARS_RIGHT */ - if ((wp->xoff == 0 || px >= wp->xoff) && - (px <= ex || (sb_w != 0 && px < ex + sb_w))) { + if ((wp->xoff == 0 || (int)px >= wp->xoff) && + ((int)px <= ex || + (sb_w != 0 && (int)px < ex + sb_w))) { if (pane_status != PANE_STATUS_BOTTOM && wp->yoff != 0 && - py == wp->yoff - 1) + (int)py == wp->yoff - 1) return (SCREEN_REDRAW_BORDER_TOP); - if (pane_status != PANE_STATUS_TOP && py == ey) + if (pane_status != PANE_STATUS_TOP && + (int)py == ey) return (SCREEN_REDRAW_BORDER_BOTTOM); } } @@ -364,7 +370,9 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py, line = wp->yoff + sy; right = wp->xoff + 2 + wp->status_size - 1; - if (py == line && px >= wp->xoff + 2 && px <= right) + if (py == line && + (int)px >= wp->xoff + 2 && + px <= right) return (CELL_INSIDE); next1: @@ -396,14 +404,14 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, u_int px, u_int py, wp->scrollbar_style.pad; if ((pane_status && py != line) || (wp->yoff == 0 && py < wp->sy) || - (py >= wp->yoff && py < wp->yoff + wp->sy)) { + ((int)py >= wp->yoff && py < wp->yoff + wp->sy)) { /* Check if px lies within a scrollbar. */ if ((sb_pos == PANE_SCROLLBARS_RIGHT && - (px >= wp->xoff + wp->sx && - px < wp->xoff + wp->sx + sb_w)) || + (px >= wp->xoff + wp->sx && + px < wp->xoff + wp->sx + sb_w)) || (sb_pos == PANE_SCROLLBARS_LEFT && - (px >= wp->xoff - sb_w && - px < wp->xoff))) + ((int)px >= wp->xoff - sb_w && + (int)px < wp->xoff))) return (CELL_SCROLLBAR); } } @@ -521,7 +529,8 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx) struct tty *tty = &c->tty; struct window_pane *wp; struct screen *s; - u_int i, x, width, xoff, yoff, size; + u_int i, x, width, size; + int xoff, yoff; log_debug("%s: %s @%u", __func__, c->name, w->id); @@ -537,10 +546,10 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx) yoff = wp->yoff + wp->sy; xoff = wp->xoff + 2; - if (xoff + size <= ctx->ox || - xoff >= ctx->ox + ctx->sx || + if (xoff + (int)size <= ctx->ox || + xoff >= ctx->ox + (int)ctx->sx || yoff < ctx->oy || - yoff >= ctx->oy + ctx->sy) + yoff >= ctx->oy + (int)ctx->sy) continue; if (xoff >= ctx->ox && xoff + size <= ctx->ox + ctx->sx) { @@ -738,8 +747,8 @@ screen_redraw_draw_borders_style(struct screen_redraw_ctx *ctx, u_int x, /* Draw arrow indicator if enabled. */ static void -screen_redraw_draw_border_arrows(struct screen_redraw_ctx *ctx, u_int i, - u_int j, u_int cell_type, struct window_pane *wp, +screen_redraw_draw_border_arrows(struct screen_redraw_ctx *ctx, int i, + int j, u_int cell_type, struct window_pane *wp, struct window_pane *active, struct grid_cell *gc) { struct client *c = ctx->c; @@ -957,14 +966,16 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp) log_debug("%s: %s @%u %%%u", __func__, c->name, w->id, wp->id); - if (wp->xoff + wp->sx <= ctx->ox || wp->xoff >= ctx->ox + ctx->sx) + if (wp->xoff + (int)wp->sx <= ctx->ox || + wp->xoff >= (int)ctx->ox + (int)ctx->sx) return; if (ctx->statustop) top = ctx->statuslines; else top = 0; for (j = 0; j < wp->sy; j++) { - if (wp->yoff + j < ctx->oy || wp->yoff + j >= ctx->oy + ctx->sy) + if (wp->yoff + (int)j < ctx->oy || + wp->yoff + j >= ctx->oy + ctx->sy) continue; y = top + wp->yoff + j - ctx->oy; diff --git a/server-client.c b/server-client.c index e970999f..f7bc2037 100644 --- a/server-client.c +++ b/server-client.c @@ -632,7 +632,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, u_int px, u_int py, if (((pane_status != PANE_STATUS_OFF && (int)py != pane_status_line && py != wp->yoff + wp->sy) || (wp->yoff == 0 && py < wp->sy) || - (py >= wp->yoff && py < wp->yoff + wp->sy)) && + ((int)py >= wp->yoff && py < wp->yoff + wp->sy)) && ((sb_pos == PANE_SCROLLBARS_RIGHT && (int)px < (int)wp->xoff + (int)wp->sx + sb_pad + sb_w) || (sb_pos == PANE_SCROLLBARS_LEFT && @@ -1058,6 +1058,8 @@ server_client_is_assume_paste(struct client *c) return (0); if ((t = options_get_number(s->options, "assume-paste-time")) == 0) return (0); + if (tty_term_has(c->tty.term, TTYC_ENBP)) + return (0); timersub(&c->activity_time, &c->last_activity_time, &tv); if (tv.tv_sec == 0 && tv.tv_usec < t * 1000) { diff --git a/tmux.h b/tmux.h index 692ee1c2..c1fff4ae 100644 --- a/tmux.h +++ b/tmux.h @@ -1115,8 +1115,8 @@ struct screen_redraw_ctx { u_int sx; u_int sy; - u_int ox; - u_int oy; + int ox; + int oy; }; /* Screen size. */ @@ -1231,6 +1231,19 @@ enum client_theme { THEME_DARK }; +/* Visible range array element. */ +struct visible_range { + u_int px; /* start */ + u_int nx; /* length */ +}; + +/* Visible areas not obstructed. */ +struct visible_ranges { + struct visible_range *ranges; /* dynamically allocated array */ + u_int used; /* number of entries in ranges */ + u_int size; /* allocated capacity of ranges */ +}; + /* Child window structure. */ struct window_pane { u_int id; @@ -1245,8 +1258,8 @@ struct window_pane { u_int sx; u_int sy; - u_int xoff; - u_int yoff; + int xoff; + int yoff; int flags; #define PANE_REDRAW 0x1 @@ -1589,19 +1602,6 @@ struct key_event { size_t len; }; -/* Visible range array element. */ -struct visible_range { - u_int px; /* start */ - u_int nx; /* length */ -}; - -/* Visible areas not obstructed. */ -struct visible_ranges { - struct visible_range *ranges; /* dynamically allocated array */ - u_int used; /* number of entries in ranges */ - u_int size; /* allocated capacity of ranges */ -}; - /* Terminal definition. */ struct tty_term { char *name;