mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
cc096ae929
@ -135,7 +135,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
cause = xstrdup("pane too small");
|
||||
goto error;
|
||||
}
|
||||
new_wp = window_add_pane(w, hlimit);
|
||||
new_wp = window_add_pane(w, wp, hlimit);
|
||||
layout_assign_pane(lc, new_wp);
|
||||
|
||||
path = NULL;
|
||||
|
@ -989,8 +989,19 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||
if (skip)
|
||||
skip = (memcmp(&now_gc, gc, sizeof now_gc) == 0);
|
||||
|
||||
/* Set the cell. */
|
||||
if (!skip)
|
||||
/* Update the selection the flag and set the cell. */
|
||||
selected = screen_check_selection(s, s->cx, s->cy);
|
||||
if (selected && ~gc->flags & GRID_FLAG_SELECTED) {
|
||||
skip = 0;
|
||||
memcpy(&tmp_gc, gc, sizeof tmp_gc);
|
||||
tmp_gc.flags |= GRID_FLAG_SELECTED;
|
||||
grid_view_set_cell(gd, s->cx, s->cy, &tmp_gc);
|
||||
} else if (!selected && gc->flags & GRID_FLAG_SELECTED) {
|
||||
skip = 0;
|
||||
memcpy(&tmp_gc, gc, sizeof tmp_gc);
|
||||
tmp_gc.flags &= ~GRID_FLAG_SELECTED;
|
||||
grid_view_set_cell(gd, s->cx, s->cy, &tmp_gc);
|
||||
} else if (!skip)
|
||||
grid_view_set_cell(gd, s->cx, s->cy, gc);
|
||||
|
||||
/*
|
||||
@ -1009,11 +1020,6 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
||||
}
|
||||
|
||||
/* Check if this is selected. */
|
||||
selected = screen_check_selection(s, s->cx - width, s->cy);
|
||||
if (selected)
|
||||
skip = 0;
|
||||
|
||||
/* Save last cell if it will be needed. */
|
||||
if (!skip && ctx->wp != NULL && ttyctx.ocx > ctx->wp->sx - width)
|
||||
screen_write_save_last(ctx, &ttyctx);
|
||||
|
13
status.c
13
status.c
@ -257,16 +257,19 @@ status_get_window_at(struct client *c, u_int x)
|
||||
struct session *s = c->session;
|
||||
struct winlink *wl;
|
||||
struct options *oo;
|
||||
size_t len;
|
||||
const char *sep;
|
||||
size_t seplen;
|
||||
|
||||
x += c->wlmouse;
|
||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||
oo = wl->window->options;
|
||||
len = strlen(options_get_string(oo, "window-status-separator"));
|
||||
|
||||
sep = options_get_string(oo, "window-status-separator");
|
||||
seplen = screen_write_cstrlen("%s", sep);
|
||||
|
||||
if (x < wl->status_width)
|
||||
return (wl->window);
|
||||
x -= wl->status_width + len;
|
||||
x -= wl->status_width + seplen;
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
@ -344,7 +347,7 @@ status_redraw(struct client *c)
|
||||
|
||||
oo = wl->window->options;
|
||||
sep = options_get_string(oo, "window-status-separator");
|
||||
seplen = screen_write_strlen("%s", sep);
|
||||
seplen = screen_write_cstrlen("%s", sep);
|
||||
wlwidth += wl->status_width + seplen;
|
||||
}
|
||||
|
||||
@ -359,7 +362,7 @@ status_redraw(struct client *c)
|
||||
|
||||
oo = wl->window->options;
|
||||
sep = options_get_string(oo, "window-status-separator");
|
||||
screen_write_nputs(&ctx, -1, &stdgc, "%s", sep);
|
||||
screen_write_cnputs(&ctx, -1, &stdgc, "%s", sep);
|
||||
}
|
||||
screen_write_stop(&ctx);
|
||||
|
||||
|
4
tmux.h
4
tmux.h
@ -644,6 +644,7 @@ enum utf8_state {
|
||||
#define GRID_FLAG_EXTENDED 0x8
|
||||
#define GRID_FLAG_FGRGB 0x10
|
||||
#define GRID_FLAG_BGRGB 0x20
|
||||
#define GRID_FLAG_SELECTED 0x40
|
||||
|
||||
/* Grid line flags. */
|
||||
#define GRID_LINE_WRAPPED 0x1
|
||||
@ -2132,7 +2133,8 @@ int window_has_pane(struct window *, struct window_pane *);
|
||||
int window_set_active_pane(struct window *, struct window_pane *);
|
||||
void window_redraw_active_switch(struct window *,
|
||||
struct window_pane *);
|
||||
struct window_pane *window_add_pane(struct window *, u_int);
|
||||
struct window_pane *window_add_pane(struct window *, struct window_pane *,
|
||||
u_int);
|
||||
void window_resize(struct window *, u_int, u_int);
|
||||
int window_zoom(struct window_pane *);
|
||||
int window_unzoom(struct window *);
|
||||
|
12
window.c
12
window.c
@ -323,7 +323,7 @@ window_create(const char *name, int argc, char **argv, const char *path,
|
||||
struct window_pane *wp;
|
||||
|
||||
w = window_create1(sx, sy);
|
||||
wp = window_add_pane(w, hlimit);
|
||||
wp = window_add_pane(w, NULL, hlimit);
|
||||
layout_init(w, wp);
|
||||
|
||||
if (window_pane_spawn(wp, argc, argv, path, shell, cwd, env, tio,
|
||||
@ -553,15 +553,19 @@ window_unzoom(struct window *w)
|
||||
}
|
||||
|
||||
struct window_pane *
|
||||
window_add_pane(struct window *w, u_int hlimit)
|
||||
window_add_pane(struct window *w, struct window_pane *after, u_int hlimit)
|
||||
{
|
||||
struct window_pane *wp;
|
||||
|
||||
wp = window_pane_create(w, w->sx, w->sy, hlimit);
|
||||
if (TAILQ_EMPTY(&w->panes))
|
||||
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
|
||||
else
|
||||
TAILQ_INSERT_AFTER(&w->panes, w->active, wp, entry);
|
||||
else {
|
||||
if (after == NULL)
|
||||
TAILQ_INSERT_AFTER(&w->panes, w->active, wp, entry);
|
||||
else
|
||||
TAILQ_INSERT_AFTER(&w->panes, after, wp, entry);
|
||||
}
|
||||
return (wp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user