Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2015-01-16 19:17:31 +00:00
commit df6488a470
5 changed files with 20 additions and 19 deletions

View File

@ -134,7 +134,7 @@ struct format_tree *
format_create(void) format_create(void)
{ {
struct format_tree *ft; struct format_tree *ft;
char host[MAXHOSTNAMELEN], *ptr; char host[HOST_NAME_MAX+1], *ptr;
ft = xcalloc(1, sizeof *ft); ft = xcalloc(1, sizeof *ft);
RB_INIT(&ft->tree); RB_INIT(&ft->tree);

View File

@ -16,7 +16,8 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <sys/param.h> #include <sys/param.h> /* MAXCOMLEN */
#include <sys/types.h>
#include <sys/proc.h> #include <sys/proc.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/stat.h> #include <sys/stat.h>

View File

@ -32,11 +32,11 @@ void screen_resize_y(struct screen *, u_int);
void void
screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit) screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit)
{ {
char host[HOST_NAME_MAX]; char host[HOST_NAME_MAX+1];
s->grid = grid_create(sx, sy, hlimit); s->grid = grid_create(sx, sy, hlimit);
if (gethostname(host, HOST_NAME_MAX) == 0) if (gethostname(host, sizeof(host)) == 0)
s->title = xstrdup(host); s->title = xstrdup(host);
else else
s->title = xstrdup(""); s->title = xstrdup("");

View File

@ -330,14 +330,12 @@ window_choose_collapse(struct window_pane *wp, struct session *s)
struct window_choose_mode_data *data = wp->modedata; struct window_choose_mode_data *data = wp->modedata;
struct window_choose_mode_item *item, *chosen; struct window_choose_mode_item *item, *chosen;
struct window_choose_data *wcd; struct window_choose_data *wcd;
u_int i, pos; u_int i;
ARRAY_DECL(, struct window_choose_mode_item) list_copy; ARRAY_DECL(, struct window_choose_mode_item) list_copy;
ARRAY_INIT(&list_copy); ARRAY_INIT(&list_copy);
pos = data->selected; chosen = &ARRAY_ITEM(&data->list, data->selected);
chosen = &ARRAY_ITEM(&data->list, pos);
chosen->state &= ~TREE_EXPANDED; chosen->state &= ~TREE_EXPANDED;
/* /*
@ -353,9 +351,8 @@ window_choose_collapse(struct window_pane *wp, struct session *s)
/* We only show the session when collapsed. */ /* We only show the session when collapsed. */
if (wcd->type & TREE_SESSION) { if (wcd->type & TREE_SESSION) {
item->state &= ~TREE_EXPANDED; item->state &= ~TREE_EXPANDED;
ARRAY_ADD(&list_copy, *item);
ARRAY_ADD(&list_copy,
ARRAY_ITEM(&data->list, i));
/* /*
* Update the selection to this session item so * Update the selection to this session item so
* we don't end up highlighting a non-existent * we don't end up highlighting a non-existent

View File

@ -390,13 +390,16 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key)
if (data->inputtype == WINDOW_COPY_JUMPFORWARD) { if (data->inputtype == WINDOW_COPY_JUMPFORWARD) {
for (; np != 0; np--) for (; np != 0; np--)
window_copy_cursor_jump(wp); window_copy_cursor_jump(wp);
} else if (data->inputtype == WINDOW_COPY_JUMPBACK) { }
if (data->inputtype == WINDOW_COPY_JUMPBACK) {
for (; np != 0; np--) for (; np != 0; np--)
window_copy_cursor_jump_back(wp); window_copy_cursor_jump_back(wp);
} else if (data->inputtype == WINDOW_COPY_JUMPTOFORWARD) { }
if (data->inputtype == WINDOW_COPY_JUMPTOFORWARD) {
for (; np != 0; np--) for (; np != 0; np--)
window_copy_cursor_jump_to(wp); window_copy_cursor_jump_to(wp);
} else if (data->inputtype == WINDOW_COPY_JUMPTOBACK) { }
if (data->inputtype == WINDOW_COPY_JUMPTOBACK) {
for (; np != 0; np--) for (; np != 0; np--)
window_copy_cursor_jump_to_back(wp); window_copy_cursor_jump_to_back(wp);
} }
@ -1771,7 +1774,7 @@ window_copy_other_end(struct window_pane *wp)
{ {
struct window_copy_mode_data *data = wp->modedata; struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen; struct screen *s = &data->screen;
u_int selx, sely, cx, cy, yy; u_int selx, sely, cx, cy, yy, hsize;
if (!s->sel.flag && s->sel.lineflag == LINE_SEL_NONE) if (!s->sel.flag && s->sel.lineflag == LINE_SEL_NONE)
return; return;
@ -1791,13 +1794,13 @@ window_copy_other_end(struct window_pane *wp)
data->sely = yy; data->sely = yy;
data->cx = selx; data->cx = selx;
if (sely < screen_hsize(data->backing) - data->oy) { hsize = screen_hsize(data->backing);
data->oy = screen_hsize(data->backing) - sely; if (sely < hsize - data->oy) {
data->oy = hsize - sely;
data->cy = 0; data->cy = 0;
} else if (sely > screen_hsize(data->backing) - data->oy + screen_size_y(s)) { } else if (sely > hsize - data->oy + screen_size_y(s)) {
data->oy = screen_hsize(data->backing) - sely + screen_size_y(s) - 1; data->oy = hsize - sely + screen_size_y(s) - 1;
data->cy = screen_size_y(s) - 1; data->cy = screen_size_y(s) - 1;
} else } else
data->cy = cy + sely - yy; data->cy = cy + sely - yy;