Merge branch 'obsd-master' into master

This commit is contained in:
Thomas Adam 2021-01-18 14:01:21 +00:00
commit 82423975df
4 changed files with 28 additions and 34 deletions

View File

@ -157,8 +157,7 @@ options_value_to_string(struct options_entry *o, union options_value *ov,
case OPTIONS_TABLE_CHOICE: case OPTIONS_TABLE_CHOICE:
s = xstrdup(o->tableentry->choices[ov->number]); s = xstrdup(o->tableentry->choices[ov->number]);
break; break;
case OPTIONS_TABLE_STRING: default:
case OPTIONS_TABLE_COMMAND:
fatalx("not a number option type"); fatalx("not a number option type");
} }
return (s); return (s);
@ -311,6 +310,8 @@ options_default_to_string(const struct options_table_entry *oe)
case OPTIONS_TABLE_CHOICE: case OPTIONS_TABLE_CHOICE:
s = xstrdup(oe->choices[oe->default_num]); s = xstrdup(oe->choices[oe->default_num]);
break; break;
default:
fatalx("unknown option type");
} }
return (s); return (s);
} }
@ -703,7 +704,7 @@ options_get_number(struct options *oo, const char *name)
if (o == NULL) if (o == NULL)
fatalx("missing option %s", name); fatalx("missing option %s", name);
if (!OPTIONS_IS_NUMBER(o)) if (!OPTIONS_IS_NUMBER(o))
fatalx("option %s is not a number", name); fatalx("option %s is not a number", name);
return (o->value.number); return (o->value.number);
} }

View File

@ -1778,11 +1778,11 @@ server_client_check_exit(struct client *c)
switch (c->exit_type) { switch (c->exit_type) {
case CLIENT_EXIT_RETURN: case CLIENT_EXIT_RETURN:
if (c->exit_message != NULL) { if (c->exit_message != NULL)
msize = strlen(c->exit_message) + 1; msize = strlen(c->exit_message) + 1;
size = (sizeof c->retval) + msize; else
} else msize = 0;
size = (sizeof c->retval); size = (sizeof c->retval) + msize;
data = xmalloc(size); data = xmalloc(size);
memcpy(data, &c->retval, sizeof c->retval); memcpy(data, &c->retval, sizeof c->retval);
if (c->exit_message != NULL) if (c->exit_message != NULL)

View File

@ -3453,10 +3453,10 @@ window_copy_synchronize_cursor_end(struct window_mode_entry *wme, int begin,
struct window_copy_mode_data *data = wme->data; struct window_copy_mode_data *data = wme->data;
u_int xx, yy; u_int xx, yy;
xx = data->cx;
yy = screen_hsize(data->backing) + data->cy - data->oy; yy = screen_hsize(data->backing) + data->cy - data->oy;
switch (data->selflag) { switch (data->selflag) {
case SEL_WORD: case SEL_WORD:
xx = data->cx;
if (no_reset) if (no_reset)
break; break;
begin = 0; begin = 0;
@ -3482,10 +3482,8 @@ window_copy_synchronize_cursor_end(struct window_mode_entry *wme, int begin,
} }
break; break;
case SEL_LINE: case SEL_LINE:
if (no_reset) { if (no_reset)
xx = data->cx;
break; break;
}
begin = 0; begin = 0;
if (data->dy > yy) { if (data->dy > yy) {
/* Right to left selection. */ /* Right to left selection. */
@ -3505,7 +3503,6 @@ window_copy_synchronize_cursor_end(struct window_mode_entry *wme, int begin,
} }
break; break;
case SEL_CHAR: case SEL_CHAR:
xx = data->cx;
break; break;
} }
if (begin) { if (begin) {
@ -4784,22 +4781,22 @@ window_copy_start_drag(struct client *c, struct mouse_event *m)
if (x < data->selrx || x > data->endselrx || yg != data->selry) if (x < data->selrx || x > data->endselrx || yg != data->selry)
data->selflag = SEL_CHAR; data->selflag = SEL_CHAR;
switch (data->selflag) { switch (data->selflag) {
case SEL_WORD: case SEL_WORD:
if (data->ws != NULL) { if (data->ws != NULL) {
window_copy_update_cursor(wme, x, y);
window_copy_cursor_previous_word_pos(wme,
data->ws, 0, &x, &y);
y -= screen_hsize(data->backing) - data->oy;
}
window_copy_update_cursor(wme, x, y); window_copy_update_cursor(wme, x, y);
break; window_copy_cursor_previous_word_pos(wme, data->ws, 0,
case SEL_LINE: &x, &y);
window_copy_update_cursor(wme, 0, y); y -= screen_hsize(data->backing) - data->oy;
break; }
case SEL_CHAR: window_copy_update_cursor(wme, x, y);
window_copy_update_cursor(wme, x, y); break;
window_copy_start_selection(wme); case SEL_LINE:
break; window_copy_update_cursor(wme, 0, y);
break;
case SEL_CHAR:
window_copy_update_cursor(wme, x, y);
window_copy_start_selection(wme);
break;
} }
window_copy_redraw_screen(wme); window_copy_redraw_screen(wme);

View File

@ -190,13 +190,6 @@ window_customize_scope_text(enum window_customize_scope scope,
u_int idx; u_int idx;
switch (scope) { switch (scope) {
case WINDOW_CUSTOMIZE_NONE:
case WINDOW_CUSTOMIZE_KEY:
case WINDOW_CUSTOMIZE_SERVER:
case WINDOW_CUSTOMIZE_GLOBAL_SESSION:
case WINDOW_CUSTOMIZE_GLOBAL_WINDOW:
s = xstrdup("");
break;
case WINDOW_CUSTOMIZE_PANE: case WINDOW_CUSTOMIZE_PANE:
window_pane_index(fs->wp, &idx); window_pane_index(fs->wp, &idx);
xasprintf(&s, "pane %u", idx); xasprintf(&s, "pane %u", idx);
@ -207,6 +200,9 @@ window_customize_scope_text(enum window_customize_scope scope,
case WINDOW_CUSTOMIZE_WINDOW: case WINDOW_CUSTOMIZE_WINDOW:
xasprintf(&s, "window %u", fs->wl->idx); xasprintf(&s, "window %u", fs->wl->idx);
break; break;
default:
s = xstrdup("");
break;
} }
return (s); return (s);
} }