Skip to content

Commit

Permalink
Merge branch 'master' of github.com:tmux/tmux
Browse files Browse the repository at this point in the history
  • Loading branch information
nicm committed Oct 18, 2016
2 parents ba9f47c + 9b991a7 commit 66d637b
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 27 deletions.
8 changes: 4 additions & 4 deletions cmd-find.c
Expand Up @@ -989,13 +989,13 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,
/* Find current state. */
if (server_check_marked() && (flags & CMD_FIND_DEFAULT_MARKED)) {
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)) {
fs->current = &item->current;
log_debug(" current is from queue");
log_debug("%s: current is from queue", __func__);
} else {
fs->current = current;
log_debug(" current is from argument");
log_debug("%s: current is from argument", __func__);
}
if (!cmd_find_empty_state(fs->current) &&
!cmd_find_valid_state(fs->current))
Expand Down Expand Up @@ -1206,7 +1206,7 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,

error:
fs->current = NULL;
log_debug(" error");
log_debug("%s: error", __func__);

free(copy);
return (-1);
Expand Down
18 changes: 15 additions & 3 deletions cmd-queue.c
Expand Up @@ -112,6 +112,8 @@ cmdq_remove(struct cmdq_item *item)
cmd_list_free(item->cmdlist);

TAILQ_REMOVE(item->queue, item, entry);

free((void *)item->name);
free(item);
}

Expand Down Expand Up @@ -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 cmd *cmd;
u_int group = cmdq_next_group();
char *tmp;

TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
xasprintf(&tmp, "command[%s]", cmd->entry->name);

item = xcalloc(1, sizeof *item);
item->name = tmp;
item->type = CMDQ_COMMAND;

item->group = group;
item->flags = flags;

Expand Down Expand Up @@ -220,12 +227,17 @@ cmdq_fire_command(struct cmdq_item *item)

/* Get a callback for the command queue. */
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;
char *tmp;

xasprintf(&tmp, "callback[%s]", name);

item = xcalloc(1, sizeof *item);
item->name = tmp;
item->type = CMDQ_CALLBACK;

item->group = 0;
item->flags = 0;

Expand Down Expand Up @@ -289,8 +301,8 @@ cmdq_next(struct client *c)
item = TAILQ_FIRST(queue);
if (item == NULL)
break;
log_debug("%s %s: type %d, flags %x", __func__, name,
item->type, item->flags);
log_debug("%s %s: %s (%d), flags %x", __func__, name,
item->name, item->type, item->flags);

/*
* Any item with the waiting flag set waits until an external
Expand Down
58 changes: 40 additions & 18 deletions grid.c
Expand Up @@ -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 *,
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. */
static void
grid_clear_cell(struct grid *gd, u_int px, u_int py, u_int bg)
{
gd->linedata[py].celldata[px] = grid_default_entry;
gd->linedata[py].celldata[px].data.bg = bg;
struct grid_line *gl = &gd->linedata[py];
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. */
Expand Down Expand Up @@ -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_cell_entry *gce;
struct grid_cell *gcp;
int extended;

if (grid_check_y(gd, py) != 0)
Expand All @@ -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);
if (!extended && (gc->data.size != 1 || gc->data.width != 1))
extended = 1;
if (!extended && ((gc->fg & COLOUR_FLAG_RGB) ||
(gc->bg & COLOUR_FLAG_RGB)))
if (!extended && (gc->fg & COLOUR_FLAG_RGB))
extended = 1;
if (!extended && (gc->bg & COLOUR_FLAG_RGB))
extended = 1;
if (extended) {
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);
grid_extended_cell(gl, gce, gc);
return;
}

Expand Down
1 change: 1 addition & 0 deletions screen-write.c
Expand Up @@ -130,6 +130,7 @@ screen_write_flush(struct screen_write_ctx *ctx)
if (dirty == ctx->dirty)
break;
}
ctx->dirty = 0;

s->cx = cx;
s->cy = cy;
Expand Down
4 changes: 3 additions & 1 deletion tmux.h
Expand Up @@ -1241,6 +1241,7 @@ enum cmdq_type {
/* Command queue item. */
typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *);
struct cmdq_item {
const char *name;
struct cmdq_list *queue;
struct cmdq_item *next;

Expand Down Expand Up @@ -1781,7 +1782,8 @@ char *cmd_list_print(struct cmd_list *);
/* cmd-queue.c */
struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmd_find_state *,
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_append(struct client *, struct cmdq_item *);
void printflike(3, 4) cmdq_format(struct cmdq_item *, const char *,
Expand Down
2 changes: 1 addition & 1 deletion window.c
Expand Up @@ -985,7 +985,7 @@ window_pane_read_callback(__unused struct bufferevent *bufev, void *data)

input_parse(wp);

wp->pipe_off = size;
wp->pipe_off = EVBUFFER_LENGTH(evb);
}

static void
Expand Down

0 comments on commit 66d637b

Please sign in to comment.