-/* $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 <nicm@users.sourceforge.net>
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 *);
}
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;
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:
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:
}
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;
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);
}
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;
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);