mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 10:58:48 +00:00
Make jump-to-backward/jump-to-forward repeatable with
jump-reverse/jump-again, from Jacob Niehus.
This commit is contained in:
parent
6f587570ed
commit
0fd9a97202
@ -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_down(struct window_pane *, int);
|
||||||
void window_copy_cursor_jump(struct window_pane *);
|
void window_copy_cursor_jump(struct window_pane *);
|
||||||
void window_copy_cursor_jump_back(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(struct window_pane *, int);
|
||||||
void window_copy_cursor_jump_to_back(struct window_pane *);
|
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(struct window_pane *, const char *);
|
||||||
void window_copy_cursor_next_word_end(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 *);
|
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) {
|
if (data->inputtype == WINDOW_COPY_JUMPTOFORWARD) {
|
||||||
for (; np != 0; np--)
|
for (; np != 0; np--)
|
||||||
window_copy_cursor_jump_to(wp);
|
window_copy_cursor_jump_to(wp, 0);
|
||||||
}
|
}
|
||||||
if (data->inputtype == WINDOW_COPY_JUMPTOBACK) {
|
if (data->inputtype == WINDOW_COPY_JUMPTOBACK) {
|
||||||
for (; np != 0; np--)
|
for (; np != 0; np--)
|
||||||
window_copy_cursor_jump_to_back(wp);
|
window_copy_cursor_jump_to_back(wp, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->jumptype = data->inputtype;
|
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);
|
window_copy_cursor_jump_back(wp);
|
||||||
} else if (data->jumptype == WINDOW_COPY_JUMPTOFORWARD) {
|
} else if (data->jumptype == WINDOW_COPY_JUMPTOFORWARD) {
|
||||||
for (; np != 0; np--)
|
for (; np != 0; np--)
|
||||||
window_copy_cursor_jump_to(wp);
|
window_copy_cursor_jump_to(wp, 1);
|
||||||
} else if (data->jumptype == WINDOW_COPY_JUMPTOBACK) {
|
} else if (data->jumptype == WINDOW_COPY_JUMPTOBACK) {
|
||||||
for (; np != 0; np--)
|
for (; np != 0; np--)
|
||||||
window_copy_cursor_jump_to_back(wp);
|
window_copy_cursor_jump_to_back(wp, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MODEKEYCOPY_JUMPREVERSE:
|
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);
|
window_copy_cursor_jump(wp);
|
||||||
} else if (data->jumptype == WINDOW_COPY_JUMPTOFORWARD) {
|
} else if (data->jumptype == WINDOW_COPY_JUMPTOFORWARD) {
|
||||||
for (; np != 0; np--)
|
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) {
|
} else if (data->jumptype == WINDOW_COPY_JUMPTOBACK) {
|
||||||
for (; np != 0; np--)
|
for (; np != 0; np--)
|
||||||
window_copy_cursor_jump_to(wp);
|
window_copy_cursor_jump_to(wp, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MODEKEYCOPY_JUMPBACK:
|
case MODEKEYCOPY_JUMPBACK:
|
||||||
@ -1944,7 +1944,7 @@ window_copy_cursor_jump_back(struct window_pane *wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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 window_copy_mode_data *data = wp->modedata;
|
||||||
struct screen *back_s = data->backing;
|
struct screen *back_s = data->backing;
|
||||||
@ -1952,7 +1952,7 @@ window_copy_cursor_jump_to(struct window_pane *wp)
|
|||||||
struct utf8_data ud;
|
struct utf8_data ud;
|
||||||
u_int px, py, xx;
|
u_int px, py, xx;
|
||||||
|
|
||||||
px = data->cx + 1;
|
px = data->cx + 1 + jump_again;
|
||||||
py = screen_hsize(back_s) + data->cy - data->oy;
|
py = screen_hsize(back_s) + data->cy - data->oy;
|
||||||
xx = window_copy_find_length(wp, py);
|
xx = window_copy_find_length(wp, py);
|
||||||
|
|
||||||
@ -1971,7 +1971,7 @@ window_copy_cursor_jump_to(struct window_pane *wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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 window_copy_mode_data *data = wp->modedata;
|
||||||
struct screen *back_s = data->backing;
|
struct screen *back_s = data->backing;
|
||||||
@ -1985,6 +1985,9 @@ window_copy_cursor_jump_to_back(struct window_pane *wp)
|
|||||||
if (px > 0)
|
if (px > 0)
|
||||||
px--;
|
px--;
|
||||||
|
|
||||||
|
if (jump_again && px > 0)
|
||||||
|
px--;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
gc = grid_peek_cell(back_s->grid, px, py);
|
gc = grid_peek_cell(back_s->grid, px, py);
|
||||||
grid_cell_get(gc, &ud);
|
grid_cell_get(gc, &ud);
|
||||||
|
Loading…
Reference in New Issue
Block a user