From: nicm Date: Mon, 20 Apr 2015 09:39:21 +0000 (+0000) Subject: Make jump-to-backward/jump-to-forward repeatable with X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=03e78375c3c5f7274427d5b11493c79327e88305;p=openbsd Make jump-to-backward/jump-to-forward repeatable with jump-reverse/jump-again, from Jacob Niehus. --- diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 9c74d0a46ec..c886cf66cf6 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.126 2015/04/19 21:34:21 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.127 2015/04/20 09:39:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -75,8 +75,8 @@ void window_copy_cursor_up(struct window_pane *, int); void window_copy_cursor_down(struct window_pane *, int); void window_copy_cursor_jump(struct window_pane *); void window_copy_cursor_jump_back(struct window_pane *); -void window_copy_cursor_jump_to(struct window_pane *); -void window_copy_cursor_jump_to_back(struct window_pane *); +void window_copy_cursor_jump_to(struct window_pane *, int); +void window_copy_cursor_jump_to_back(struct window_pane *, int); void window_copy_cursor_next_word(struct window_pane *, const char *); void window_copy_cursor_next_word_end(struct window_pane *, const char *); void window_copy_cursor_previous_word(struct window_pane *, const char *); @@ -397,11 +397,11 @@ window_copy_key(struct window_pane *wp, struct client *c, struct session *sess, } if (data->inputtype == WINDOW_COPY_JUMPTOFORWARD) { for (; np != 0; np--) - window_copy_cursor_jump_to(wp); + window_copy_cursor_jump_to(wp, 0); } if (data->inputtype == WINDOW_COPY_JUMPTOBACK) { for (; np != 0; np--) - window_copy_cursor_jump_to_back(wp); + window_copy_cursor_jump_to_back(wp, 0); } } data->jumptype = data->inputtype; @@ -643,10 +643,10 @@ window_copy_key(struct window_pane *wp, struct client *c, struct session *sess, window_copy_cursor_jump_back(wp); } else if (data->jumptype == WINDOW_COPY_JUMPTOFORWARD) { for (; np != 0; np--) - window_copy_cursor_jump_to(wp); + window_copy_cursor_jump_to(wp, 1); } else if (data->jumptype == WINDOW_COPY_JUMPTOBACK) { for (; np != 0; np--) - window_copy_cursor_jump_to_back(wp); + window_copy_cursor_jump_to_back(wp, 1); } break; case MODEKEYCOPY_JUMPREVERSE: @@ -658,10 +658,10 @@ window_copy_key(struct window_pane *wp, struct client *c, struct session *sess, window_copy_cursor_jump(wp); } else if (data->jumptype == WINDOW_COPY_JUMPTOFORWARD) { for (; np != 0; np--) - window_copy_cursor_jump_to_back(wp); + window_copy_cursor_jump_to_back(wp, 1); } else if (data->jumptype == WINDOW_COPY_JUMPTOBACK) { for (; np != 0; np--) - window_copy_cursor_jump_to(wp); + window_copy_cursor_jump_to(wp, 1); } break; case MODEKEYCOPY_JUMPBACK: @@ -1944,7 +1944,7 @@ window_copy_cursor_jump_back(struct window_pane *wp) } void -window_copy_cursor_jump_to(struct window_pane *wp) +window_copy_cursor_jump_to(struct window_pane *wp, int jump_again) { struct window_copy_mode_data *data = wp->modedata; struct screen *back_s = data->backing; @@ -1952,7 +1952,7 @@ window_copy_cursor_jump_to(struct window_pane *wp) struct utf8_data ud; u_int px, py, xx; - px = data->cx + 1; + px = data->cx + 1 + jump_again; py = screen_hsize(back_s) + data->cy - data->oy; xx = window_copy_find_length(wp, py); @@ -1971,7 +1971,7 @@ window_copy_cursor_jump_to(struct window_pane *wp) } void -window_copy_cursor_jump_to_back(struct window_pane *wp) +window_copy_cursor_jump_to_back(struct window_pane *wp, int jump_again) { struct window_copy_mode_data *data = wp->modedata; struct screen *back_s = data->backing; @@ -1985,6 +1985,9 @@ window_copy_cursor_jump_to_back(struct window_pane *wp) if (px > 0) px--; + if (jump_again && px > 0) + px--; + for (;;) { gc = grid_peek_cell(back_s->grid, px, py); grid_cell_get(gc, &ud);