Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2019-11-25 22:01:56 +00:00
commit eaf526b1ea

View File

@ -1837,133 +1837,134 @@ static const struct {
const char *command; const char *command;
int minargs; int minargs;
int maxargs; int maxargs;
int ismotion;
enum window_copy_cmd_action (*f)(struct window_copy_cmd_state *); enum window_copy_cmd_action (*f)(struct window_copy_cmd_state *);
} window_copy_cmd_table[] = { } window_copy_cmd_table[] = {
{ "append-selection", 0, 0, { "append-selection", 0, 0, 0,
window_copy_cmd_append_selection }, window_copy_cmd_append_selection },
{ "append-selection-and-cancel", 0, 0, { "append-selection-and-cancel", 0, 0, 0,
window_copy_cmd_append_selection_and_cancel }, window_copy_cmd_append_selection_and_cancel },
{ "back-to-indentation", 0, 0, { "back-to-indentation", 0, 0, 0,
window_copy_cmd_back_to_indentation }, window_copy_cmd_back_to_indentation },
{ "begin-selection", 0, 0, { "begin-selection", 0, 0, 0,
window_copy_cmd_begin_selection }, window_copy_cmd_begin_selection },
{ "bottom-line", 0, 0, { "bottom-line", 0, 0, 1,
window_copy_cmd_bottom_line }, window_copy_cmd_bottom_line },
{ "cancel", 0, 0, { "cancel", 0, 0, 0,
window_copy_cmd_cancel }, window_copy_cmd_cancel },
{ "clear-selection", 0, 0, { "clear-selection", 0, 0, 0,
window_copy_cmd_clear_selection }, window_copy_cmd_clear_selection },
{ "copy-end-of-line", 0, 1, { "copy-end-of-line", 0, 1, 0,
window_copy_cmd_copy_end_of_line }, window_copy_cmd_copy_end_of_line },
{ "copy-line", 0, 1, { "copy-line", 0, 1, 0,
window_copy_cmd_copy_line }, window_copy_cmd_copy_line },
{ "copy-pipe-no-clear", 1, 2, { "copy-pipe-no-clear", 1, 2, 0,
window_copy_cmd_copy_pipe_no_clear }, window_copy_cmd_copy_pipe_no_clear },
{ "copy-pipe", 1, 2, { "copy-pipe", 1, 2, 0,
window_copy_cmd_copy_pipe }, window_copy_cmd_copy_pipe },
{ "copy-pipe-and-cancel", 1, 2, { "copy-pipe-and-cancel", 1, 2, 0,
window_copy_cmd_copy_pipe_and_cancel }, window_copy_cmd_copy_pipe_and_cancel },
{ "copy-selection-no-clear", 0, 1, { "copy-selection-no-clear", 0, 1, 0,
window_copy_cmd_copy_selection_no_clear }, window_copy_cmd_copy_selection_no_clear },
{ "copy-selection", 0, 1, { "copy-selection", 0, 1, 0,
window_copy_cmd_copy_selection }, window_copy_cmd_copy_selection },
{ "copy-selection-and-cancel", 0, 1, { "copy-selection-and-cancel", 0, 1, 0,
window_copy_cmd_copy_selection_and_cancel }, window_copy_cmd_copy_selection_and_cancel },
{ "cursor-down", 0, 0, { "cursor-down", 0, 0, 1,
window_copy_cmd_cursor_down }, window_copy_cmd_cursor_down },
{ "cursor-down-and-cancel", 0, 0, { "cursor-down-and-cancel", 0, 0, 0,
window_copy_cmd_cursor_down_and_cancel }, window_copy_cmd_cursor_down_and_cancel },
{ "cursor-left", 0, 0, { "cursor-left", 0, 0, 1,
window_copy_cmd_cursor_left }, window_copy_cmd_cursor_left },
{ "cursor-right", 0, 0, { "cursor-right", 0, 0, 1,
window_copy_cmd_cursor_right }, window_copy_cmd_cursor_right },
{ "cursor-up", 0, 0, { "cursor-up", 0, 0, 1,
window_copy_cmd_cursor_up }, window_copy_cmd_cursor_up },
{ "end-of-line", 0, 0, { "end-of-line", 0, 0, 1,
window_copy_cmd_end_of_line }, window_copy_cmd_end_of_line },
{ "goto-line", 1, 1, { "goto-line", 1, 1, 1,
window_copy_cmd_goto_line }, window_copy_cmd_goto_line },
{ "halfpage-down", 0, 0, { "halfpage-down", 0, 0, 1,
window_copy_cmd_halfpage_down }, window_copy_cmd_halfpage_down },
{ "halfpage-down-and-cancel", 0, 0, { "halfpage-down-and-cancel", 0, 0, 0,
window_copy_cmd_halfpage_down_and_cancel }, window_copy_cmd_halfpage_down_and_cancel },
{ "halfpage-up", 0, 0, { "halfpage-up", 0, 0, 1,
window_copy_cmd_halfpage_up }, window_copy_cmd_halfpage_up },
{ "history-bottom", 0, 0, { "history-bottom", 0, 0, 1,
window_copy_cmd_history_bottom }, window_copy_cmd_history_bottom },
{ "history-top", 0, 0, { "history-top", 0, 0, 1,
window_copy_cmd_history_top }, window_copy_cmd_history_top },
{ "jump-again", 0, 0, { "jump-again", 0, 0, 1,
window_copy_cmd_jump_again }, window_copy_cmd_jump_again },
{ "jump-backward", 1, 1, { "jump-backward", 1, 1, 1,
window_copy_cmd_jump_backward }, window_copy_cmd_jump_backward },
{ "jump-forward", 1, 1, { "jump-forward", 1, 1, 1,
window_copy_cmd_jump_forward }, window_copy_cmd_jump_forward },
{ "jump-reverse", 0, 0, { "jump-reverse", 0, 0, 1,
window_copy_cmd_jump_reverse }, window_copy_cmd_jump_reverse },
{ "jump-to-backward", 1, 1, { "jump-to-backward", 1, 1, 1,
window_copy_cmd_jump_to_backward }, window_copy_cmd_jump_to_backward },
{ "jump-to-forward", 1, 1, { "jump-to-forward", 1, 1, 1,
window_copy_cmd_jump_to_forward }, window_copy_cmd_jump_to_forward },
{ "middle-line", 0, 0, { "middle-line", 0, 0, 1,
window_copy_cmd_middle_line }, window_copy_cmd_middle_line },
{ "next-matching-bracket", 0, 0, { "next-matching-bracket", 0, 0, 0,
window_copy_cmd_next_matching_bracket }, window_copy_cmd_next_matching_bracket },
{ "next-paragraph", 0, 0, { "next-paragraph", 0, 0, 1,
window_copy_cmd_next_paragraph }, window_copy_cmd_next_paragraph },
{ "next-space", 0, 0, { "next-space", 0, 0, 1,
window_copy_cmd_next_space }, window_copy_cmd_next_space },
{ "next-space-end", 0, 0, { "next-space-end", 0, 0, 1,
window_copy_cmd_next_space_end }, window_copy_cmd_next_space_end },
{ "next-word", 0, 0, { "next-word", 0, 0, 1,
window_copy_cmd_next_word }, window_copy_cmd_next_word },
{ "next-word-end", 0, 0, { "next-word-end", 0, 0, 1,
window_copy_cmd_next_word_end }, window_copy_cmd_next_word_end },
{ "other-end", 0, 0, { "other-end", 0, 0, 1,
window_copy_cmd_other_end }, window_copy_cmd_other_end },
{ "page-down", 0, 0, { "page-down", 0, 0, 1,
window_copy_cmd_page_down }, window_copy_cmd_page_down },
{ "page-down-and-cancel", 0, 0, { "page-down-and-cancel", 0, 0, 0,
window_copy_cmd_page_down_and_cancel }, window_copy_cmd_page_down_and_cancel },
{ "page-up", 0, 0, { "page-up", 0, 0, 1,
window_copy_cmd_page_up }, window_copy_cmd_page_up },
{ "previous-matching-bracket", 0, 0, { "previous-matching-bracket", 0, 0, 0,
window_copy_cmd_previous_matching_bracket }, window_copy_cmd_previous_matching_bracket },
{ "previous-paragraph", 0, 0, { "previous-paragraph", 0, 0, 1,
window_copy_cmd_previous_paragraph }, window_copy_cmd_previous_paragraph },
{ "previous-space", 0, 0, { "previous-space", 0, 0, 1,
window_copy_cmd_previous_space }, window_copy_cmd_previous_space },
{ "previous-word", 0, 0, { "previous-word", 0, 0, 1,
window_copy_cmd_previous_word }, window_copy_cmd_previous_word },
{ "rectangle-toggle", 0, 0, { "rectangle-toggle", 0, 0, 0,
window_copy_cmd_rectangle_toggle }, window_copy_cmd_rectangle_toggle },
{ "scroll-down", 0, 0, { "scroll-down", 0, 0, 1,
window_copy_cmd_scroll_down }, window_copy_cmd_scroll_down },
{ "scroll-down-and-cancel", 0, 0, { "scroll-down-and-cancel", 0, 0, 0,
window_copy_cmd_scroll_down_and_cancel }, window_copy_cmd_scroll_down_and_cancel },
{ "scroll-up", 0, 0, { "scroll-up", 0, 0, 1,
window_copy_cmd_scroll_up }, window_copy_cmd_scroll_up },
{ "search-again", 0, 0, { "search-again", 0, 0, 0,
window_copy_cmd_search_again }, window_copy_cmd_search_again },
{ "search-backward", 0, 1, { "search-backward", 0, 1, 0,
window_copy_cmd_search_backward }, window_copy_cmd_search_backward },
{ "search-backward-incremental", 1, 1, { "search-backward-incremental", 1, 1, 0,
window_copy_cmd_search_backward_incremental }, window_copy_cmd_search_backward_incremental },
{ "search-forward", 0, 1, { "search-forward", 0, 1, 0,
window_copy_cmd_search_forward }, window_copy_cmd_search_forward },
{ "search-forward-incremental", 1, 1, { "search-forward-incremental", 1, 1, 0,
window_copy_cmd_search_forward_incremental }, window_copy_cmd_search_forward_incremental },
{ "search-reverse", 0, 0, { "search-reverse", 0, 0, 0,
window_copy_cmd_search_reverse }, window_copy_cmd_search_reverse },
{ "select-line", 0, 0, { "select-line", 0, 0, 0,
window_copy_cmd_select_line }, window_copy_cmd_select_line },
{ "select-word", 0, 0, { "select-word", 0, 0, 0,
window_copy_cmd_select_word }, window_copy_cmd_select_word },
{ "start-of-line", 0, 0, { "start-of-line", 0, 0, 1,
window_copy_cmd_start_of_line }, window_copy_cmd_start_of_line },
{ "stop-selection", 0, 0, { "stop-selection", 0, 0, 0,
window_copy_cmd_stop_selection }, window_copy_cmd_stop_selection },
{ "top-line", 0, 0, { "top-line", 0, 0, 1,
window_copy_cmd_top_line }, window_copy_cmd_top_line },
}; };
@ -1977,6 +1978,7 @@ window_copy_command(struct window_mode_entry *wme, struct client *c,
enum window_copy_cmd_action action; enum window_copy_cmd_action action;
const char *command; const char *command;
u_int i; u_int i;
int ismotion, keys;
if (args->argc == 0) if (args->argc == 0)
return; return;
@ -1999,16 +2001,23 @@ window_copy_command(struct window_mode_entry *wme, struct client *c,
if (args->argc - 1 < window_copy_cmd_table[i].minargs || if (args->argc - 1 < window_copy_cmd_table[i].minargs ||
args->argc - 1 > window_copy_cmd_table[i].maxargs) args->argc - 1 > window_copy_cmd_table[i].maxargs)
break; break;
ismotion = window_copy_cmd_table[i].ismotion;
action = window_copy_cmd_table[i].f (&cs); action = window_copy_cmd_table[i].f (&cs);
break; break;
} }
} }
if (strncmp(command, "search-", 7) != 0 && data->searchmark != NULL) { if (strncmp(command, "search-", 7) != 0 && data->searchmark != NULL) {
window_copy_clear_marks(wme); keys = options_get_number(wme->wp->window->options, "mode-keys");
if (keys != MODEKEY_VI || !ismotion) {
window_copy_clear_marks(wme);
data->searchx = data->searchy = -1;
} else if (data->searchthis != -1) {
data->searchthis = -1;
action = WINDOW_COPY_CMD_REDRAW;
}
if (action == WINDOW_COPY_CMD_NOTHING) if (action == WINDOW_COPY_CMD_NOTHING)
action = WINDOW_COPY_CMD_REDRAW; action = WINDOW_COPY_CMD_REDRAW;
data->searchx = data->searchy = -1;
} }
wme->prefix = 1; wme->prefix = 1;