mirror of
https://github.com/tmux/tmux.git
synced 2026-05-30 22:26:18 +00:00
Merge branch 'floating_panes' into floating_panes_staging
This commit is contained in:
@@ -704,7 +704,7 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
|
|||||||
/* Left not visible. */
|
/* Left not visible. */
|
||||||
l = ctx->ox - xoff;
|
l = ctx->ox - xoff;
|
||||||
x = 0;
|
x = 0;
|
||||||
width = size - i;
|
width = size - l;
|
||||||
} else {
|
} else {
|
||||||
/* Right not visible. */
|
/* Right not visible. */
|
||||||
l = 0;
|
l = 0;
|
||||||
@@ -712,7 +712,8 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
|
|||||||
width = size - x;
|
width = size - x;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = screen_redraw_get_visible_ranges(wp, x, yoff, width, NULL);
|
r = tty_check_overlay_range(tty, x, yoff, width);
|
||||||
|
r = screen_redraw_get_visible_ranges(wp, x, yoff, width, r);
|
||||||
if (ctx->statustop)
|
if (ctx->statustop)
|
||||||
yoff += ctx->statuslines;
|
yoff += ctx->statuslines;
|
||||||
for (i = 0; i < r->used; i++) {
|
for (i = 0; i < r->used; i++) {
|
||||||
@@ -1275,15 +1276,40 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
|
|||||||
struct screen *s = wp->screen;
|
struct screen *s = wp->screen;
|
||||||
struct colour_palette *palette = &wp->palette;
|
struct colour_palette *palette = &wp->palette;
|
||||||
struct grid_cell defaults;
|
struct grid_cell defaults;
|
||||||
u_int i, j, woy, wx, wy, py, width;
|
u_int j, k, woy, wx, wy, py, width;
|
||||||
struct visible_ranges *r;
|
struct visible_ranges *r;
|
||||||
struct visible_range *ri;
|
struct visible_range *ri;
|
||||||
|
|
||||||
|
/* There are 3 coordinate spaces:
|
||||||
|
* window: (0 to w->sx-1, 0 to w->sy-1)
|
||||||
|
* tty: (0 to tty->sx-1, 0 to tty->sy-1)
|
||||||
|
* pane: (0 to wp->sx-1, 0 to wp->sy-1)
|
||||||
|
*
|
||||||
|
* Transformations:
|
||||||
|
* window <-> tty (x-axis):
|
||||||
|
* window_x = tty_x + ctx->ox
|
||||||
|
* tty_x = window_x - ctx->ox
|
||||||
|
*
|
||||||
|
* window <-> tty (y-axis):
|
||||||
|
* woy = (ctx->statustop) ? ctx->statuslines : 0
|
||||||
|
* window_y = tty_y + ctx->oy - woy
|
||||||
|
* tty_y = woy + window_y - ctx->oy
|
||||||
|
*
|
||||||
|
* window <-> pane (x-axis):
|
||||||
|
* window_x = pane_x + wp->xoff
|
||||||
|
* pane_x = window_x - wp->xoff
|
||||||
|
*
|
||||||
|
* window <-> pane (y-axis):
|
||||||
|
* window_y = pane_y + wp->yoff
|
||||||
|
* pane_y = window_y - wp->yoff
|
||||||
|
*/
|
||||||
|
|
||||||
if (wp->base.mode & MODE_SYNC)
|
if (wp->base.mode & MODE_SYNC)
|
||||||
screen_write_stop_sync(wp);
|
screen_write_stop_sync(wp);
|
||||||
|
|
||||||
log_debug("%s: %s @%u %%%u", __func__, c->name, w->id, wp->id);
|
log_debug("%s: %s @%u %%%u", __func__, c->name, w->id, wp->id);
|
||||||
|
|
||||||
|
/* Check if pane completely not visible. */
|
||||||
if (wp->xoff + (int)wp->sx <= ctx->ox ||
|
if (wp->xoff + (int)wp->sx <= ctx->ox ||
|
||||||
wp->xoff >= (int)ctx->ox + (int)ctx->sx)
|
wp->xoff >= (int)ctx->ox + (int)ctx->sx)
|
||||||
return;
|
return;
|
||||||
@@ -1305,37 +1331,36 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
|
|||||||
if (wp->xoff >= (int)ctx->ox &&
|
if (wp->xoff >= (int)ctx->ox &&
|
||||||
wp->xoff + (int)wp->sx <= (int)ctx->ox + (int)ctx->sx) {
|
wp->xoff + (int)wp->sx <= (int)ctx->ox + (int)ctx->sx) {
|
||||||
/* All visible. */
|
/* All visible. */
|
||||||
i = 0;
|
|
||||||
wx = (u_int)(wp->xoff - (int)ctx->ox);
|
wx = (u_int)(wp->xoff - (int)ctx->ox);
|
||||||
width = wp->sx;
|
width = wp->sx;
|
||||||
} else if (wp->xoff < (int)ctx->ox &&
|
} else if (wp->xoff < (int)ctx->ox &&
|
||||||
wp->xoff + (int)wp->sx > (int)ctx->ox + (int)ctx->sx) {
|
wp->xoff + (int)wp->sx > (int)ctx->ox + (int)ctx->sx) {
|
||||||
/* Both left and right not visible. */
|
/* Both left and right not visible. */
|
||||||
i = ctx->ox;
|
|
||||||
wx = 0;
|
wx = 0;
|
||||||
width = ctx->sx;
|
width = ctx->sx;
|
||||||
} else if (wp->xoff < (int)ctx->ox) {
|
} else if (wp->xoff < (int)ctx->ox) {
|
||||||
/* Left not visible. */
|
/* Left not visible. */
|
||||||
i = (u_int)((int)ctx->ox - wp->xoff);
|
|
||||||
wx = 0;
|
wx = 0;
|
||||||
width = wp->sx - i;
|
width = wp->sx - ((u_int)((int)ctx->ox - wp->xoff));
|
||||||
} else {
|
} else {
|
||||||
/* Right not visible. */
|
/* Right not visible. */
|
||||||
i = 0;
|
|
||||||
wx = (u_int)(wp->xoff - (int)ctx->ox);
|
wx = (u_int)(wp->xoff - (int)ctx->ox);
|
||||||
width = ctx->sx - wx;
|
width = ctx->sx - wx;
|
||||||
}
|
}
|
||||||
log_debug("%s: %s %%%u line %u,%u at %u,%u, width %u",
|
|
||||||
__func__, c->name, wp->id, i, j, wx, wy, width);
|
|
||||||
|
|
||||||
/* Get visible ranges of line before we draw it. */
|
/* Get visible ranges of line before we draw it. */
|
||||||
r = screen_redraw_get_visible_ranges(wp, wx, wy, width, NULL);
|
r = tty_check_overlay_range(tty, wx, wy, width);
|
||||||
|
r = screen_redraw_get_visible_ranges(wp, wx, wy, width, r);
|
||||||
tty_default_colours(&defaults, wp);
|
tty_default_colours(&defaults, wp);
|
||||||
for (i = 0; i < r->used; i++) {
|
for (k = 0; k < r->used; k++) {
|
||||||
ri = &r->ranges[i];
|
ri = &r->ranges[k];
|
||||||
if (ri->nx == 0)
|
if (ri->nx == 0)
|
||||||
continue;
|
continue;
|
||||||
tty_draw_line(tty, s, ri->px - wp->xoff, j, ri->nx,
|
log_debug("%s: %s %%%u range pane (%u,%u) width %u, tty (%u,%u) width %u",
|
||||||
|
__func__, c->name, wp->id,
|
||||||
|
ri->px + (int)ctx->ox - wp->xoff, j, ri->nx,
|
||||||
|
ri->px, py, ri->nx);
|
||||||
|
tty_draw_line(tty, s, ri->px + (int)ctx->ox - wp->xoff, j, ri->nx,
|
||||||
ri->px, py, &defaults, palette);
|
ri->px, py, &defaults, palette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1497,7 +1522,7 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx,
|
|||||||
|
|
||||||
for (j = jmin; j < jmax; j++) {
|
for (j = jmin; j < jmax; j++) {
|
||||||
wy = sb_y + j; /* window y coordinate */
|
wy = sb_y + j; /* window y coordinate */
|
||||||
py = sb_tty_y + j;/* tty y coordinate */
|
py = sb_tty_y + j; /* tty y coordinate */
|
||||||
r = tty_check_overlay_range(tty, sb_x, wy, imax);
|
r = tty_check_overlay_range(tty, sb_x, wy, imax);
|
||||||
r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r);
|
r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r);
|
||||||
for (i = imin; i < imax; i++) {
|
for (i = imin; i < imax; i++) {
|
||||||
|
|||||||
20
tty-draw.c
20
tty-draw.c
@@ -46,10 +46,6 @@ static void
|
|||||||
tty_draw_line_clear(struct tty *tty, u_int px, u_int py, u_int nx,
|
tty_draw_line_clear(struct tty *tty, u_int px, u_int py, u_int nx,
|
||||||
const struct grid_cell *defaults, u_int bg, int wrapped)
|
const struct grid_cell *defaults, u_int bg, int wrapped)
|
||||||
{
|
{
|
||||||
struct visible_ranges *r;
|
|
||||||
struct visible_range *rr;
|
|
||||||
u_int i;
|
|
||||||
|
|
||||||
/* Nothing to clear. */
|
/* Nothing to clear. */
|
||||||
if (nx == 0)
|
if (nx == 0)
|
||||||
return;
|
return;
|
||||||
@@ -82,20 +78,14 @@ tty_draw_line_clear(struct tty *tty, u_int px, u_int py, u_int nx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Couldn't use an escape sequence, use spaces. */
|
/* Couldn't use an escape sequence, use spaces. */
|
||||||
r = tty_check_overlay_range(tty, px, py, nx);
|
if (px != 0 || !wrapped)
|
||||||
for (i = 0; i < r->used; i++) {
|
tty_cursor(tty, px, py);
|
||||||
rr = &r->ranges[i];
|
if (nx == 1)
|
||||||
if (rr->nx != 0) {
|
|
||||||
if (rr->px != 0 || !wrapped)
|
|
||||||
tty_cursor(tty, rr->px, py);
|
|
||||||
if (rr->nx == 1)
|
|
||||||
tty_putc(tty, ' ');
|
tty_putc(tty, ' ');
|
||||||
else if (rr->nx == 2)
|
else if (nx == 2)
|
||||||
tty_putn(tty, " ", 2, 2);
|
tty_putn(tty, " ", 2, 2);
|
||||||
else
|
else
|
||||||
tty_repeat_space(tty, rr->nx);
|
tty_repeat_space(tty, nx);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw a line from screen to tty. */
|
/* Draw a line from screen to tty. */
|
||||||
|
|||||||
17
tty.c
17
tty.c
@@ -1306,9 +1306,7 @@ tty_clear_area(struct tty *tty, const struct tty_ctx *ctx, u_int py,
|
|||||||
{
|
{
|
||||||
struct client *c = tty->client;
|
struct client *c = tty->client;
|
||||||
const struct grid_cell *defaults = &ctx->defaults;
|
const struct grid_cell *defaults = &ctx->defaults;
|
||||||
struct visible_ranges *r;
|
u_int yy;
|
||||||
struct visible_range *ri;
|
|
||||||
u_int i, yy, oy = 0;
|
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
|
|
||||||
log_debug("%s: %s, %u,%u at %u,%u", __func__, c->name, nx, ny, px, py);
|
log_debug("%s: %s, %u,%u at %u,%u", __func__, c->name, nx, ny, px, py);
|
||||||
@@ -1373,17 +1371,8 @@ tty_clear_area(struct tty *tty, const struct tty_ctx *ctx, u_int py,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Couldn't use an escape sequence, loop over the lines. */
|
/* Couldn't use an escape sequence, loop over the lines. */
|
||||||
if (c->session->statusat == 0)
|
for (yy = py; yy < py + ny; yy++)
|
||||||
oy = c->session->statuslines;
|
tty_clear_line(tty, defaults, yy, px, nx, bg);
|
||||||
for (yy = py; yy < py + ny; yy++) {
|
|
||||||
r = tty_check_overlay_range(tty, px, yy - oy, nx);
|
|
||||||
for (i = 0; i < r->used; i++) {
|
|
||||||
ri = &r->ranges[i];
|
|
||||||
if (ri->nx == 0)
|
|
||||||
continue;
|
|
||||||
tty_clear_line(tty, defaults, yy, ri->px, ri->nx, bg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear an area in a pane. */
|
/* Clear an area in a pane. */
|
||||||
|
|||||||
Reference in New Issue
Block a user