diff --git a/cmd-find.c b/cmd-find.c index 46551e2d..fd119cb2 100644 --- a/cmd-find.c +++ b/cmd-find.c @@ -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)) @@ -1206,7 +1206,7 @@ current: error: fs->current = NULL; - log_debug(" error"); + log_debug("%s: error", __func__); free(copy); return (-1); diff --git a/cmd-queue.c b/cmd-queue.c index 5056fffc..24fd0c56 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -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); } @@ -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; @@ -220,12 +227,17 @@ out: /* 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; @@ -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 diff --git a/grid.c b/grid.c index d0a28463..9619c4fe 100644 --- a/grid.c +++ b/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 *, 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. */ @@ -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) @@ -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; } diff --git a/screen-write.c b/screen-write.c index 95caabce..d5fc1dee 100644 --- a/screen-write.c +++ b/screen-write.c @@ -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; diff --git a/tmux.h b/tmux.h index ed349330..519057e7 100644 --- a/tmux.h +++ b/tmux.h @@ -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; @@ -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 *, diff --git a/window.c b/window.c index 8b215d78..18212098 100644 --- a/window.c +++ b/window.c @@ -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