version 1.93, 2012/07/09 09:55:57 |
version 1.94, 2012/07/10 11:53:01 |
|
|
/* Calculate the total size needed for the window list. */ |
/* Calculate the total size needed for the window list. */ |
wlstart = wloffset = wlwidth = 0; |
wlstart = wloffset = wlwidth = 0; |
RB_FOREACH(wl, winlinks, &s->windows) { |
RB_FOREACH(wl, winlinks, &s->windows) { |
if (wl->status_text != NULL) |
free(wl->status_text); |
xfree(wl->status_text); |
|
memcpy(&wl->status_cell, &stdgc, sizeof wl->status_cell); |
memcpy(&wl->status_cell, &stdgc, sizeof wl->status_cell); |
wl->status_text = status_print(c, wl, t, &wl->status_cell); |
wl->status_text = status_print(c, wl, t, &wl->status_cell); |
wl->status_width = |
wl->status_width = |
|
|
screen_write_stop(&ctx); |
screen_write_stop(&ctx); |
|
|
out: |
out: |
if (left != NULL) |
free(left); |
xfree(left); |
free(right); |
if (right != NULL) |
|
xfree(right); |
|
|
|
if (grid_compare(c->status.grid, old_status.grid) == 0) { |
if (grid_compare(c->status.grid, old_status.grid) == 0) { |
screen_free(&old_status); |
screen_free(&old_status); |
|
|
} |
} |
|
|
out: |
out: |
if (freeptr != NULL) |
free(freeptr); |
xfree(freeptr); |
|
return; |
return; |
|
|
skip_to: |
skip_to: |
|
|
cmd[len++] = **iptr; |
cmd[len++] = **iptr; |
} |
} |
if (**iptr == '\0') /* no terminating ) */ { |
if (**iptr == '\0') /* no terminating ) */ { |
xfree(cmd); |
free(cmd); |
return (NULL); |
return (NULL); |
} |
} |
(*iptr)++; /* skip final ) */ |
(*iptr)++; /* skip final ) */ |
|
|
so_find.cmd = cmd; |
so_find.cmd = cmd; |
so = RB_FIND(status_out_tree, &c->status_new, &so_find); |
so = RB_FIND(status_out_tree, &c->status_new, &so_find); |
if (so != NULL && so->out != NULL) { |
if (so != NULL && so->out != NULL) { |
xfree(cmd); |
free(cmd); |
return (so->out); |
return (so->out); |
} |
} |
|
|
|
|
/* Lookup in the old tree. */ |
/* Lookup in the old tree. */ |
so_find.cmd = cmd; |
so_find.cmd = cmd; |
so = RB_FIND(status_out_tree, &c->status_old, &so_find); |
so = RB_FIND(status_out_tree, &c->status_old, &so_find); |
xfree(cmd); |
free(cmd); |
if (so != NULL) |
if (so != NULL) |
return (so->out); |
return (so->out); |
return (NULL); |
return (NULL); |
|
|
so_next = RB_NEXT(status_out_tree, sotree, so); |
so_next = RB_NEXT(status_out_tree, sotree, so); |
|
|
RB_REMOVE(status_out_tree, sotree, so); |
RB_REMOVE(status_out_tree, sotree, so); |
if (so->out != NULL) |
free(so->out); |
xfree(so->out); |
free(so->cmd); |
xfree(so->cmd); |
free(so); |
xfree(so); |
|
} |
} |
} |
} |
|
|
|
|
limit = ARRAY_LENGTH(&c->message_log) - limit; |
limit = ARRAY_LENGTH(&c->message_log) - limit; |
for (i = 0; i < limit; i++) { |
for (i = 0; i < limit; i++) { |
msg = &ARRAY_FIRST(&c->message_log); |
msg = &ARRAY_FIRST(&c->message_log); |
xfree(msg->msg); |
free(msg->msg); |
ARRAY_REMOVE(&c->message_log, 0); |
ARRAY_REMOVE(&c->message_log, 0); |
} |
} |
} |
} |
|
|
if (c->message_string == NULL) |
if (c->message_string == NULL) |
return; |
return; |
|
|
xfree(c->message_string); |
free(c->message_string); |
c->message_string = NULL; |
c->message_string = NULL; |
|
|
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE); |
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE); |
|
|
if (c->prompt_freefn != NULL && c->prompt_data != NULL) |
if (c->prompt_freefn != NULL && c->prompt_data != NULL) |
c->prompt_freefn(c->prompt_data); |
c->prompt_freefn(c->prompt_data); |
|
|
xfree(c->prompt_string); |
free(c->prompt_string); |
c->prompt_string = NULL; |
c->prompt_string = NULL; |
|
|
xfree(c->prompt_buffer); |
free(c->prompt_buffer); |
c->prompt_buffer = NULL; |
c->prompt_buffer = NULL; |
|
|
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE); |
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE); |
|
|
void |
void |
status_prompt_update(struct client *c, const char *msg, const char *input) |
status_prompt_update(struct client *c, const char *msg, const char *input) |
{ |
{ |
xfree(c->prompt_string); |
free(c->prompt_string); |
c->prompt_string = status_replace(c, NULL, NULL, NULL, msg, |
c->prompt_string = status_replace(c, NULL, NULL, NULL, msg, |
time(NULL), 0); |
time(NULL), 0); |
|
|
xfree(c->prompt_buffer); |
free(c->prompt_buffer); |
c->prompt_buffer = status_replace(c, NULL, NULL, NULL, input, |
c->prompt_buffer = status_replace(c, NULL, NULL, NULL, input, |
time(NULL), 0); |
time(NULL), 0); |
c->prompt_index = strlen(c->prompt_buffer); |
c->prompt_index = strlen(c->prompt_buffer); |
|
|
memcpy(first, s, strlen(s)); |
memcpy(first, s, strlen(s)); |
|
|
c->prompt_index = (first - c->prompt_buffer) + strlen(s); |
c->prompt_index = (first - c->prompt_buffer) + strlen(s); |
xfree(s); |
free(s); |
|
|
c->flags |= CLIENT_STATUS; |
c->flags |= CLIENT_STATUS; |
break; |
break; |
|
|
histstr = status_prompt_up_history(&c->prompt_hindex); |
histstr = status_prompt_up_history(&c->prompt_hindex); |
if (histstr == NULL) |
if (histstr == NULL) |
break; |
break; |
xfree(c->prompt_buffer); |
free(c->prompt_buffer); |
c->prompt_buffer = xstrdup(histstr); |
c->prompt_buffer = xstrdup(histstr); |
c->prompt_index = strlen(c->prompt_buffer); |
c->prompt_index = strlen(c->prompt_buffer); |
c->flags |= CLIENT_STATUS; |
c->flags |= CLIENT_STATUS; |
|
|
histstr = status_prompt_down_history(&c->prompt_hindex); |
histstr = status_prompt_down_history(&c->prompt_hindex); |
if (histstr == NULL) |
if (histstr == NULL) |
break; |
break; |
xfree(c->prompt_buffer); |
free(c->prompt_buffer); |
c->prompt_buffer = xstrdup(histstr); |
c->prompt_buffer = xstrdup(histstr); |
c->prompt_index = strlen(c->prompt_buffer); |
c->prompt_index = strlen(c->prompt_buffer); |
c->flags |= CLIENT_STATUS; |
c->flags |= CLIENT_STATUS; |
|
|
return; |
return; |
|
|
if (size == PROMPT_HISTORY) { |
if (size == PROMPT_HISTORY) { |
xfree(ARRAY_FIRST(&status_prompt_history)); |
free(ARRAY_FIRST(&status_prompt_history)); |
ARRAY_REMOVE(&status_prompt_history, 0); |
ARRAY_REMOVE(&status_prompt_history, 0); |
} |
} |
|
|