diff --git a/cmd-join-pane.c b/cmd-join-pane.c index dee370cc..04cc0676 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -70,20 +70,24 @@ cmd_join_pane_place(struct cmdq_item *item, struct winlink *wl, struct window_pane *owp; int wx = w->sx, wy = w->sy, px = lc->sx; int py = lc->sy, xoff = lc->xoff, yoff = lc->yoff; + int border = 1; + + if (window_pane_get_pane_lines(wp) == PANE_LINES_NONE) + border = 0; if (strcmp(position, "top-left") == 0) { - xoff = 1; - yoff = 1; + xoff = border; + yoff = border; } else if (strcmp(position, "top-centre") == 0 || strcmp(position, "top-center") == 0) { xoff = (wx - px) / 2; - yoff = 1; + yoff = border; } else if (strcmp(position, "top-right") == 0) { - xoff = wx - px - 1; - yoff = 1; + xoff = wx - px - border; + yoff = border; } else if (strcmp(position, "centre-left") == 0 || strcmp(position, "center-left") == 0) { - xoff = 1; + xoff = border; yoff = (wy - py) / 2; } else if (strcmp(position, "centre") == 0 || strcmp(position, "center") == 0) { @@ -91,18 +95,18 @@ cmd_join_pane_place(struct cmdq_item *item, struct winlink *wl, yoff = (wy - py) / 2; } else if (strcmp(position, "centre-right") == 0 || strcmp(position, "center-right") == 0) { - xoff = wx - px - 1; + xoff = wx - px - border; yoff = (wy - py) / 2; } else if (strcmp(position, "bottom-left") == 0) { - xoff = 1; - yoff = wy - py - 1; + xoff = border; + yoff = wy - py - border; } else if (strcmp(position, "bottom-centre") == 0 || strcmp(position, "bottom-center") == 0) { xoff = (wx - px) / 2; - yoff = wy - py - 1; + yoff = wy - py - border; } else if (strcmp(position, "bottom-right") == 0) { - xoff = wx - px - 1; - yoff = wy - py - 1; + xoff = wx - px - border; + yoff = wy - py - border; } else if (strcmp(position, "top-left-centre") == 0 || strcmp(position, "top-left-center") == 0) { xoff = wx / 4 - px / 2; diff --git a/layout.c b/layout.c index 686d1bdf..0e8a2a2a 100644 --- a/layout.c +++ b/layout.c @@ -712,7 +712,8 @@ layout_resize_floating_pane_to(struct window_pane *wp, enum layout_type type, return; } - if (size >= PANE_MINIMUM + 2) + if (window_pane_get_pane_lines(wp) != PANE_LINES_NONE && + size >= PANE_MINIMUM + 2) size -= 2; if (size < PANE_MINIMUM || size > PANE_MAXIMUM) { *cause = xstrdup("size is too big or too small"); diff --git a/options-table.c b/options-table.c index 8f82c328..ca9c071f 100644 --- a/options-table.c +++ b/options-table.c @@ -76,7 +76,7 @@ static const char *options_table_pane_border_indicators_list[] = { "off", "colour", "arrows", "both", NULL }; static const char *options_table_pane_border_lines_list[] = { - "single", "double", "heavy", "simple", "number", "spaces", NULL + "single", "double", "heavy", "simple", "number", "spaces", "none", NULL }; static const char *options_table_popup_border_lines_list[] = { "single", "double", "heavy", "simple", "rounded", "padded", "none", NULL diff --git a/screen-redraw.c b/screen-redraw.c index 0e497243..3bec3852 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -87,6 +87,7 @@ screen_redraw_border_set(struct window *w, struct window_pane *wp, gc->attr &= ~GRID_ATTR_CHARSET; utf8_set(&gc->data, SIMPLE_BORDERS[cell_type]); break; + case PANE_LINES_NONE: case PANE_LINES_SPACES: gc->attr &= ~GRID_ATTR_CHARSET; utf8_set(&gc->data, ' '); @@ -140,6 +141,10 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp, if (px >= wp->xoff && px < ex && py >= wp->yoff && py < ey) return (SCREEN_REDRAW_INSIDE); + if (window_pane_is_floating(wp) && + window_pane_get_pane_lines(wp) == PANE_LINES_NONE) + return (SCREEN_REDRAW_OUTSIDE); + /* Are scrollbars enabled? */ if (window_pane_show_scrollbar(wp, pane_scrollbars)) sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad; @@ -1153,7 +1158,7 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px, struct window *w; struct visible_range *ri; static struct visible_ranges sr = { NULL, 0, 0 }; - int found_self, sb, sb_w, sb_pos; + int found_self, sb, sb_w, sb_pos, no_border; int lb, rb, tb, bb, sx, ex; u_int i, s; @@ -1203,8 +1208,18 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px, continue; } - tb = wp->yoff > 0 ? wp->yoff - 1 : 0; - bb = wp->yoff + wp->sy; + if (window_pane_is_floating(wp) && + window_pane_get_pane_lines(wp) == PANE_LINES_NONE) + no_border = 1; + else + no_border = 0; + if (no_border) { + tb = wp->yoff; + bb = wp->yoff + (int)wp->sy - 1; + } else { + tb = wp->yoff > 0 ? wp->yoff - 1 : 0; + bb = wp->yoff + (int)wp->sy; + } if (!found_self || !window_pane_visible(wp) || py < tb || @@ -1219,7 +1234,10 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px, for (i = 0; i < r->used; i++) { ri = &r->ranges[i]; - if (sb_pos == PANE_SCROLLBARS_LEFT) { + if (no_border) { + lb = wp->xoff; + rb = wp->xoff + (int)wp->sx - 1; + } else if (sb_pos == PANE_SCROLLBARS_LEFT) { if (wp->xoff > sb_w) lb = wp->xoff - 1 - sb_w; else @@ -1230,11 +1248,19 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px, else lb = 0; } - if (sb_pos == PANE_SCROLLBARS_LEFT) - rb = wp->xoff + wp->sx; - else /* PANE_SCROLLBARS_RIGHT or none. */ - rb = wp->xoff + wp->sx + sb_w; - if (rb > (int)w->sx) + if (!no_border) { + if (sb_pos == PANE_SCROLLBARS_LEFT) + rb = wp->xoff + (int)wp->sx; + else /* PANE_SCROLLBARS_RIGHT or none. */ + rb = wp->xoff + (int)wp->sx + sb_w; + } + if (lb < 0) + lb = 0; + if (rb < 0) + continue; + if (no_border && rb >= (int)w->sx) + rb = w->sx - 1; + else if (!no_border && rb > (int)w->sx) rb = w->sx - 1; sx = ri->px; diff --git a/server-client.c b/server-client.c index fff93808..2e7194b5 100644 --- a/server-client.c +++ b/server-client.c @@ -598,6 +598,7 @@ server_client_exec(struct client *c, const char *cmd) free(msg); } +/* Is the mouse inside a pane? */ static enum key_code_mouse_location server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py, u_int *sl_mpos) @@ -655,6 +656,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py, } else /* py > sl_bottom */ return (KEYC_MOUSE_LOCATION_SCROLLBAR_DOWN); } else if (window_pane_is_floating(wp) && + window_pane_get_pane_lines(wp) != PANE_LINES_NONE && (px == wp->xoff - 1 || py == wp->yoff - 1 || py == wp->yoff + (int)wp->sy)) { @@ -670,6 +672,9 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py, if ((w->flags & WINDOW_ZOOMED) && (~fwp->flags & PANE_ZOOMED)) continue; + if (window_pane_is_floating(fwp) && + window_pane_get_pane_lines(fwp) == PANE_LINES_NONE) + continue; bdr_top = fwp->yoff - 1; bdr_bottom = fwp->yoff + fwp->sy; if (sb_pos == PANE_SCROLLBARS_LEFT) @@ -1506,12 +1511,14 @@ server_client_handle_key0(struct client *c, struct key_event *event, return (1); } +/* Handle key and insert at end of queue. */ int server_client_handle_key(struct client *c, struct key_event *event) { return (server_client_handle_key0(c, event, NULL, NULL)); } +/* Handle key and insert after another item. */ int server_client_handle_key_after(struct client *c, struct key_event *event, struct cmdq_item *after, struct cmdq_item **next) diff --git a/tmux.1 b/tmux.1 index a4453b0d..64fdbdd0 100644 --- a/tmux.1 +++ b/tmux.1 @@ -5636,6 +5636,8 @@ simple ASCII characters the pane number .It spaces space characters +.It none +no border for floating panes .El .Pp .Ql double diff --git a/tmux.h b/tmux.h index 522d7d20..39677edb 100644 --- a/tmux.h +++ b/tmux.h @@ -1091,7 +1091,8 @@ enum pane_lines { PANE_LINES_HEAVY, PANE_LINES_SIMPLE, PANE_LINES_NUMBER, - PANE_LINES_SPACES + PANE_LINES_SPACES, + PANE_LINES_NONE }; /* Pane border indicator option. */ diff --git a/window.c b/window.c index aae319c1..76830c80 100644 --- a/window.c +++ b/window.c @@ -674,11 +674,18 @@ window_get_active_at(struct window *w, u_int x, u_int y) continue; } } else { - /* Floating - include all borders. */ - if ((int)x < xoff - 1 || x > xoff + sx) - continue; - if ((int)y < yoff - 1 || y > yoff + sy) - continue; + if (window_pane_get_pane_lines(wp) == PANE_LINES_NONE) { + if ((int)x < xoff || (int)x >= xoff + (int)sx) + continue; + if ((int)y < yoff || (int)y >= yoff + (int)sy) + continue; + } else { + /* Floating - include all borders. */ + if ((int)x < xoff - 1 || x > xoff + sx) + continue; + if ((int)y < yoff - 1 || y > yoff + sy) + continue; + } } return (wp); } @@ -2190,6 +2197,8 @@ window_pane_get_pane_status(struct window_pane *wp) if (!window_pane_is_floating(wp)) return (window_get_pane_status(wp->window)); + if (window_pane_get_pane_lines(wp) == PANE_LINES_NONE) + return (PANE_STATUS_OFF); status = options_get_number(wp->options, "pane-border-status"); if (status == PANE_STATUS_TOP_FLOATING)