mirror of
https://github.com/tmux/tmux.git
synced 2024-10-06 12:28:57 +00:00
Merge branch 'master' of github.com:tmux/tmux
This commit is contained in:
commit
66d637be3d
@ -989,13 +989,13 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,
|
|||||||
/* Find current state. */
|
/* Find current state. */
|
||||||
if (server_check_marked() && (flags & CMD_FIND_DEFAULT_MARKED)) {
|
if (server_check_marked() && (flags & CMD_FIND_DEFAULT_MARKED)) {
|
||||||
fs->current = &marked_pane;
|
fs->current = &marked_pane;
|
||||||
log_debug(" current is marked pane");
|
log_debug("%s: current is marked pane", __func__);
|
||||||
} else if (cmd_find_valid_state(&item->current)) {
|
} else if (cmd_find_valid_state(&item->current)) {
|
||||||
fs->current = &item->current;
|
fs->current = &item->current;
|
||||||
log_debug(" current is from queue");
|
log_debug("%s: current is from queue", __func__);
|
||||||
} else {
|
} else {
|
||||||
fs->current = current;
|
fs->current = current;
|
||||||
log_debug(" current is from argument");
|
log_debug("%s: current is from argument", __func__);
|
||||||
}
|
}
|
||||||
if (!cmd_find_empty_state(fs->current) &&
|
if (!cmd_find_empty_state(fs->current) &&
|
||||||
!cmd_find_valid_state(fs->current))
|
!cmd_find_valid_state(fs->current))
|
||||||
@ -1206,7 +1206,7 @@ current:
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
fs->current = NULL;
|
fs->current = NULL;
|
||||||
log_debug(" error");
|
log_debug("%s: error", __func__);
|
||||||
|
|
||||||
free(copy);
|
free(copy);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
18
cmd-queue.c
18
cmd-queue.c
@ -112,6 +112,8 @@ cmdq_remove(struct cmdq_item *item)
|
|||||||
cmd_list_free(item->cmdlist);
|
cmd_list_free(item->cmdlist);
|
||||||
|
|
||||||
TAILQ_REMOVE(item->queue, item, entry);
|
TAILQ_REMOVE(item->queue, item, entry);
|
||||||
|
|
||||||
|
free((void *)item->name);
|
||||||
free(item);
|
free(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,10 +149,15 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current,
|
|||||||
struct cmdq_item *item, *first = NULL, *last = NULL;
|
struct cmdq_item *item, *first = NULL, *last = NULL;
|
||||||
struct cmd *cmd;
|
struct cmd *cmd;
|
||||||
u_int group = cmdq_next_group();
|
u_int group = cmdq_next_group();
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
|
TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
|
||||||
|
xasprintf(&tmp, "command[%s]", cmd->entry->name);
|
||||||
|
|
||||||
item = xcalloc(1, sizeof *item);
|
item = xcalloc(1, sizeof *item);
|
||||||
|
item->name = tmp;
|
||||||
item->type = CMDQ_COMMAND;
|
item->type = CMDQ_COMMAND;
|
||||||
|
|
||||||
item->group = group;
|
item->group = group;
|
||||||
item->flags = flags;
|
item->flags = flags;
|
||||||
|
|
||||||
@ -220,12 +227,17 @@ out:
|
|||||||
|
|
||||||
/* Get a callback for the command queue. */
|
/* Get a callback for the command queue. */
|
||||||
struct cmdq_item *
|
struct cmdq_item *
|
||||||
cmdq_get_callback(cmdq_cb cb, void *data)
|
cmdq_get_callback1(const char *name, cmdq_cb cb, void *data)
|
||||||
{
|
{
|
||||||
struct cmdq_item *item;
|
struct cmdq_item *item;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
xasprintf(&tmp, "callback[%s]", name);
|
||||||
|
|
||||||
item = xcalloc(1, sizeof *item);
|
item = xcalloc(1, sizeof *item);
|
||||||
|
item->name = tmp;
|
||||||
item->type = CMDQ_CALLBACK;
|
item->type = CMDQ_CALLBACK;
|
||||||
|
|
||||||
item->group = 0;
|
item->group = 0;
|
||||||
item->flags = 0;
|
item->flags = 0;
|
||||||
|
|
||||||
@ -289,8 +301,8 @@ cmdq_next(struct client *c)
|
|||||||
item = TAILQ_FIRST(queue);
|
item = TAILQ_FIRST(queue);
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
break;
|
break;
|
||||||
log_debug("%s %s: type %d, flags %x", __func__, name,
|
log_debug("%s %s: %s (%d), flags %x", __func__, name,
|
||||||
item->type, item->flags);
|
item->name, item->type, item->flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Any item with the waiting flag set waits until an external
|
* Any item with the waiting flag set waits until an external
|
||||||
|
58
grid.c
58
grid.c
@ -59,12 +59,46 @@ static size_t grid_string_cells_bg(const struct grid_cell *, int *);
|
|||||||
static void grid_string_cells_code(const struct grid_cell *,
|
static void grid_string_cells_code(const struct grid_cell *,
|
||||||
const struct grid_cell *, char *, size_t, int);
|
const struct grid_cell *, char *, size_t, int);
|
||||||
|
|
||||||
|
/* Set cell as extended. */
|
||||||
|
static struct grid_cell *
|
||||||
|
grid_extended_cell(struct grid_line *gl, struct grid_cell_entry *gce,
|
||||||
|
const struct grid_cell *gc)
|
||||||
|
{
|
||||||
|
struct grid_cell *gcp;
|
||||||
|
|
||||||
|
gl->flags |= GRID_LINE_EXTENDED;
|
||||||
|
|
||||||
|
if (~gce->flags & GRID_FLAG_EXTENDED) {
|
||||||
|
gl->extddata = xreallocarray(gl->extddata, gl->extdsize + 1,
|
||||||
|
sizeof *gl->extddata);
|
||||||
|
gce->offset = gl->extdsize++;
|
||||||
|
gce->flags = gc->flags | GRID_FLAG_EXTENDED;
|
||||||
|
}
|
||||||
|
if (gce->offset >= gl->extdsize)
|
||||||
|
fatalx("offset too big");
|
||||||
|
|
||||||
|
gcp = &gl->extddata[gce->offset];
|
||||||
|
memcpy(gcp, gc, sizeof *gcp);
|
||||||
|
return (gcp);
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy default into a cell. */
|
/* Copy default into a cell. */
|
||||||
static void
|
static void
|
||||||
grid_clear_cell(struct grid *gd, u_int px, u_int py, u_int bg)
|
grid_clear_cell(struct grid *gd, u_int px, u_int py, u_int bg)
|
||||||
{
|
{
|
||||||
gd->linedata[py].celldata[px] = grid_default_entry;
|
struct grid_line *gl = &gd->linedata[py];
|
||||||
gd->linedata[py].celldata[px].data.bg = bg;
|
struct grid_cell_entry *gce = &gl->celldata[px];
|
||||||
|
struct grid_cell *gc;
|
||||||
|
|
||||||
|
memcpy(gce, &grid_default_cell, sizeof *gce);
|
||||||
|
if (bg & COLOUR_FLAG_RGB) {
|
||||||
|
gc = grid_extended_cell(gl, gce, &grid_default_cell);
|
||||||
|
gc->bg = bg;
|
||||||
|
} else {
|
||||||
|
if (bg & COLOUR_FLAG_256)
|
||||||
|
gce->flags |= GRID_FLAG_BG256;
|
||||||
|
gce->data.bg = bg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check grid y position. */
|
/* Check grid y position. */
|
||||||
@ -322,7 +356,6 @@ grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
|
|||||||
{
|
{
|
||||||
struct grid_line *gl;
|
struct grid_line *gl;
|
||||||
struct grid_cell_entry *gce;
|
struct grid_cell_entry *gce;
|
||||||
struct grid_cell *gcp;
|
|
||||||
int extended;
|
int extended;
|
||||||
|
|
||||||
if (grid_check_y(gd, py) != 0)
|
if (grid_check_y(gd, py) != 0)
|
||||||
@ -339,23 +372,12 @@ grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
|
|||||||
extended = (gce->flags & GRID_FLAG_EXTENDED);
|
extended = (gce->flags & GRID_FLAG_EXTENDED);
|
||||||
if (!extended && (gc->data.size != 1 || gc->data.width != 1))
|
if (!extended && (gc->data.size != 1 || gc->data.width != 1))
|
||||||
extended = 1;
|
extended = 1;
|
||||||
if (!extended && ((gc->fg & COLOUR_FLAG_RGB) ||
|
if (!extended && (gc->fg & COLOUR_FLAG_RGB))
|
||||||
(gc->bg & COLOUR_FLAG_RGB)))
|
extended = 1;
|
||||||
|
if (!extended && (gc->bg & COLOUR_FLAG_RGB))
|
||||||
extended = 1;
|
extended = 1;
|
||||||
if (extended) {
|
if (extended) {
|
||||||
gl->flags |= GRID_LINE_EXTENDED;
|
grid_extended_cell(gl, gce, gc);
|
||||||
|
|
||||||
if (~gce->flags & GRID_FLAG_EXTENDED) {
|
|
||||||
gl->extddata = xreallocarray(gl->extddata,
|
|
||||||
gl->extdsize + 1, sizeof *gl->extddata);
|
|
||||||
gce->offset = gl->extdsize++;
|
|
||||||
gce->flags = gc->flags | GRID_FLAG_EXTENDED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gce->offset >= gl->extdsize)
|
|
||||||
fatalx("offset too big");
|
|
||||||
gcp = &gl->extddata[gce->offset];
|
|
||||||
memcpy(gcp, gc, sizeof *gcp);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ screen_write_flush(struct screen_write_ctx *ctx)
|
|||||||
if (dirty == ctx->dirty)
|
if (dirty == ctx->dirty)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
ctx->dirty = 0;
|
||||||
|
|
||||||
s->cx = cx;
|
s->cx = cx;
|
||||||
s->cy = cy;
|
s->cy = cy;
|
||||||
|
4
tmux.h
4
tmux.h
@ -1241,6 +1241,7 @@ enum cmdq_type {
|
|||||||
/* Command queue item. */
|
/* Command queue item. */
|
||||||
typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *);
|
typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *);
|
||||||
struct cmdq_item {
|
struct cmdq_item {
|
||||||
|
const char *name;
|
||||||
struct cmdq_list *queue;
|
struct cmdq_list *queue;
|
||||||
struct cmdq_item *next;
|
struct cmdq_item *next;
|
||||||
|
|
||||||
@ -1781,7 +1782,8 @@ char *cmd_list_print(struct cmd_list *);
|
|||||||
/* cmd-queue.c */
|
/* cmd-queue.c */
|
||||||
struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmd_find_state *,
|
struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmd_find_state *,
|
||||||
struct mouse_event *, int);
|
struct mouse_event *, int);
|
||||||
struct cmdq_item *cmdq_get_callback(cmdq_cb, void *);
|
#define cmdq_get_callback(cb, data) cmdq_get_callback1(#cb, cb, data)
|
||||||
|
struct cmdq_item *cmdq_get_callback1(const char *, cmdq_cb, void *);
|
||||||
void cmdq_insert_after(struct cmdq_item *, struct cmdq_item *);
|
void cmdq_insert_after(struct cmdq_item *, struct cmdq_item *);
|
||||||
void cmdq_append(struct client *, struct cmdq_item *);
|
void cmdq_append(struct client *, struct cmdq_item *);
|
||||||
void printflike(3, 4) cmdq_format(struct cmdq_item *, const char *,
|
void printflike(3, 4) cmdq_format(struct cmdq_item *, const char *,
|
||||||
|
Loading…
Reference in New Issue
Block a user