=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window-copy.c,v retrieving revision 1.183 retrieving revision 1.184 diff -u -r1.183 -r1.184 --- src/usr.bin/tmux/window-copy.c 2017/09/04 09:18:51 1.183 +++ src/usr.bin/tmux/window-copy.c 2017/09/13 07:31:07 1.184 @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.183 2017/09/04 09:18:51 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.184 2017/09/13 07:31:07 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -57,9 +57,9 @@ static int window_copy_is_lowercase(const char *); static int window_copy_search_jump(struct window_pane *, struct grid *, struct grid *, u_int, u_int, u_int, int, int, int); -static int window_copy_search(struct window_pane *, int, int); -static int window_copy_search_up(struct window_pane *, int); -static int window_copy_search_down(struct window_pane *, int); +static int window_copy_search(struct window_pane *, int); +static int window_copy_search_up(struct window_pane *); +static int window_copy_search_down(struct window_pane *); static void window_copy_goto_line(struct window_pane *, const char *); static void window_copy_update_cursor(struct window_pane *, u_int, u_int); static void window_copy_start_selection(struct window_pane *); @@ -91,8 +91,8 @@ static void window_copy_cursor_down(struct window_pane *, int); static void window_copy_cursor_jump(struct window_pane *); static void window_copy_cursor_jump_back(struct window_pane *); -static void window_copy_cursor_jump_to(struct window_pane *, int); -static void window_copy_cursor_jump_to_back(struct window_pane *, int); +static void window_copy_cursor_jump_to(struct window_pane *); +static void window_copy_cursor_jump_to_back(struct window_pane *); static void window_copy_cursor_next_word(struct window_pane *, const char *); static void window_copy_cursor_next_word_end(struct window_pane *, @@ -667,11 +667,11 @@ break; case WINDOW_COPY_JUMPTOFORWARD: for (; np != 0; np--) - window_copy_cursor_jump_to(wp, 1); + window_copy_cursor_jump_to(wp); break; case WINDOW_COPY_JUMPTOBACKWARD: for (; np != 0; np--) - window_copy_cursor_jump_to_back(wp, 1); + window_copy_cursor_jump_to_back(wp); break; } } @@ -687,11 +687,11 @@ break; case WINDOW_COPY_JUMPTOFORWARD: for (; np != 0; np--) - window_copy_cursor_jump_to_back(wp, 1); + window_copy_cursor_jump_to_back(wp); break; case WINDOW_COPY_JUMPTOBACKWARD: for (; np != 0; np--) - window_copy_cursor_jump_to(wp, 1); + window_copy_cursor_jump_to(wp); break; } } @@ -769,19 +769,19 @@ if (strcmp(command, "search-again") == 0) { if (data->searchtype == WINDOW_COPY_SEARCHUP) { for (; np != 0; np--) - window_copy_search_up(wp, 1); + window_copy_search_up(wp); } else if (data->searchtype == WINDOW_COPY_SEARCHDOWN) { for (; np != 0; np--) - window_copy_search_down(wp, 1); + window_copy_search_down(wp); } } if (strcmp(command, "search-reverse") == 0) { if (data->searchtype == WINDOW_COPY_SEARCHUP) { for (; np != 0; np--) - window_copy_search_down(wp, 1); + window_copy_search_down(wp); } else if (data->searchtype == WINDOW_COPY_SEARCHDOWN) { for (; np != 0; np--) - window_copy_search_up(wp, 1); + window_copy_search_up(wp); } } if (strcmp(command, "select-line") == 0) { @@ -841,27 +841,27 @@ data->jumptype = WINDOW_COPY_JUMPTOBACKWARD; data->jumpchar = *argument; for (; np != 0; np--) - window_copy_cursor_jump_to_back(wp, 1); + window_copy_cursor_jump_to_back(wp); } if (strcmp(command, "jump-to-forward") == 0) { data->jumptype = WINDOW_COPY_JUMPTOFORWARD; data->jumpchar = *argument; for (; np != 0; np--) - window_copy_cursor_jump_to(wp, 1); + window_copy_cursor_jump_to(wp); } if (strcmp(command, "search-backward") == 0) { data->searchtype = WINDOW_COPY_SEARCHUP; free(data->searchstr); data->searchstr = xstrdup(argument); for (; np != 0; np--) - window_copy_search_up(wp, 1); + window_copy_search_up(wp); } if (strcmp(command, "search-forward") == 0) { data->searchtype = WINDOW_COPY_SEARCHDOWN; free(data->searchstr); data->searchstr = xstrdup(argument); for (; np != 0; np--) - window_copy_search_down(wp, 1); + window_copy_search_down(wp); } if (strcmp(command, "search-backward-incremental") == 0) { prefix = *argument++; @@ -883,7 +883,7 @@ data->searchtype = WINDOW_COPY_SEARCHUP; free(data->searchstr); data->searchstr = xstrdup(argument); - if (!window_copy_search_up(wp, 1)) { + if (!window_copy_search_up(wp)) { window_copy_clear_marks(wp); redraw = 1; } @@ -891,7 +891,7 @@ data->searchtype = WINDOW_COPY_SEARCHDOWN; free(data->searchstr); data->searchstr = xstrdup(argument); - if (!window_copy_search_down(wp, 1)) { + if (!window_copy_search_down(wp)) { window_copy_clear_marks(wp); redraw = 1; } @@ -917,7 +917,7 @@ data->searchtype = WINDOW_COPY_SEARCHDOWN; free(data->searchstr); data->searchstr = xstrdup(argument); - if (!window_copy_search_down(wp, 1)) { + if (!window_copy_search_down(wp)) { window_copy_clear_marks(wp); redraw = 1; } @@ -925,7 +925,7 @@ data->searchtype = WINDOW_COPY_SEARCHUP; free(data->searchstr); data->searchstr = xstrdup(argument); - if (!window_copy_search_up(wp, 1)) { + if (!window_copy_search_up(wp)) { window_copy_clear_marks(wp); redraw = 1; } @@ -1128,11 +1128,10 @@ /* * Search in for text searchstr. If direction is 0 then search up, otherwise - * down. If moveflag is 0 then look for string at the current cursor position - * as well. + * down. */ static int -window_copy_search(struct window_pane *wp, int direction, int moveflag) +window_copy_search(struct window_pane *wp, int direction) { struct window_copy_mode_data *data = wp->modedata; struct screen *s = data->backing, ss; @@ -1152,12 +1151,10 @@ screen_write_nputs(&ctx, -1, &grid_default_cell, "%s", data->searchstr); screen_write_stop(&ctx); - if (moveflag) { - if (direction) - window_copy_move_right(s, &fx, &fy); - else - window_copy_move_left(s, &fx, &fy); - } + if (direction) + window_copy_move_right(s, &fx, &fy); + else + window_copy_move_left(s, &fx, &fy); window_copy_clear_selection(wp); wrapflag = options_get_number(wp->window->options, "wrap-search"); @@ -1243,15 +1240,15 @@ } static int -window_copy_search_up(struct window_pane *wp, int moveflag) +window_copy_search_up(struct window_pane *wp) { - return (window_copy_search(wp, 0, moveflag)); + return (window_copy_search(wp, 0)); } static int -window_copy_search_down(struct window_pane *wp, int moveflag) +window_copy_search_down(struct window_pane *wp) { - return (window_copy_search(wp, 1, moveflag)); + return (window_copy_search(wp, 1)); } static void @@ -2166,14 +2163,14 @@ } static void -window_copy_cursor_jump_to(struct window_pane *wp, int jump_again) +window_copy_cursor_jump_to(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; struct screen *back_s = data->backing; struct grid_cell gc; u_int px, py, xx; - px = data->cx + 1 + jump_again; + px = data->cx + 2; py = screen_hsize(back_s) + data->cy - data->oy; xx = window_copy_find_length(wp, py); @@ -2191,7 +2188,7 @@ } static void -window_copy_cursor_jump_to_back(struct window_pane *wp, int jump_again) +window_copy_cursor_jump_to_back(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; struct screen *back_s = data->backing; @@ -2204,7 +2201,7 @@ if (px > 0) px--; - if (jump_again && px > 0) + if (px > 0) px--; for (;;) {