mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-27 02:23:15 +01:00
Key to swap to other end of selection (bound to o with vi keys), from J
Raynor.
This commit is contained in:
parent
bf35441608
commit
7fa55b0419
@ -292,6 +292,7 @@ const struct mode_key_entry mode_key_vi_copy[] = {
|
|||||||
{ 'k', 0, MODEKEYCOPY_UP },
|
{ 'k', 0, MODEKEYCOPY_UP },
|
||||||
{ 'l', 0, MODEKEYCOPY_RIGHT },
|
{ 'l', 0, MODEKEYCOPY_RIGHT },
|
||||||
{ 'n', 0, MODEKEYCOPY_SEARCHAGAIN },
|
{ 'n', 0, MODEKEYCOPY_SEARCHAGAIN },
|
||||||
|
{ 'o', 0, MODEKEYCOPY_OTHEREND },
|
||||||
{ 't', 0, MODEKEYCOPY_JUMPTO },
|
{ 't', 0, MODEKEYCOPY_JUMPTO },
|
||||||
{ 'q', 0, MODEKEYCOPY_CANCEL },
|
{ 'q', 0, MODEKEYCOPY_CANCEL },
|
||||||
{ 'v', 0, MODEKEYCOPY_RECTANGLETOGGLE },
|
{ 'v', 0, MODEKEYCOPY_RECTANGLETOGGLE },
|
||||||
|
1
tmux.1
1
tmux.1
@ -870,6 +870,7 @@ The following keys are supported as appropriate for the mode:
|
|||||||
.It Li "Next space, end of word" Ta "E" Ta ""
|
.It Li "Next space, end of word" Ta "E" Ta ""
|
||||||
.It Li "Next word" Ta "w" Ta ""
|
.It Li "Next word" Ta "w" Ta ""
|
||||||
.It Li "Next word end" Ta "e" Ta "M-f"
|
.It Li "Next word end" Ta "e" Ta "M-f"
|
||||||
|
.It Li "Other end of selection" Ta "o" Ta ""
|
||||||
.It Li "Paste buffer" Ta "p" Ta "C-y"
|
.It Li "Paste buffer" Ta "p" Ta "C-y"
|
||||||
.It Li "Previous page" Ta "C-b" Ta "Page up"
|
.It Li "Previous page" Ta "C-b" Ta "Page up"
|
||||||
.It Li "Previous word" Ta "b" Ta "M-b"
|
.It Li "Previous word" Ta "b" Ta "M-b"
|
||||||
|
1
tmux.h
1
tmux.h
@ -564,6 +564,7 @@ enum mode_key_cmd {
|
|||||||
MODEKEYCOPY_NEXTSPACEEND,
|
MODEKEYCOPY_NEXTSPACEEND,
|
||||||
MODEKEYCOPY_NEXTWORD,
|
MODEKEYCOPY_NEXTWORD,
|
||||||
MODEKEYCOPY_NEXTWORDEND,
|
MODEKEYCOPY_NEXTWORDEND,
|
||||||
|
MODEKEYCOPY_OTHEREND,
|
||||||
MODEKEYCOPY_PREVIOUSPAGE,
|
MODEKEYCOPY_PREVIOUSPAGE,
|
||||||
MODEKEYCOPY_PREVIOUSSPACE,
|
MODEKEYCOPY_PREVIOUSSPACE,
|
||||||
MODEKEYCOPY_PREVIOUSWORD,
|
MODEKEYCOPY_PREVIOUSWORD,
|
||||||
|
@ -65,6 +65,7 @@ u_int window_copy_find_length(struct window_pane *, u_int);
|
|||||||
void window_copy_cursor_start_of_line(struct window_pane *);
|
void window_copy_cursor_start_of_line(struct window_pane *);
|
||||||
void window_copy_cursor_back_to_indentation(struct window_pane *);
|
void window_copy_cursor_back_to_indentation(struct window_pane *);
|
||||||
void window_copy_cursor_end_of_line(struct window_pane *);
|
void window_copy_cursor_end_of_line(struct window_pane *);
|
||||||
|
void window_copy_other_end(struct window_pane *);
|
||||||
void window_copy_cursor_left(struct window_pane *);
|
void window_copy_cursor_left(struct window_pane *);
|
||||||
void window_copy_cursor_right(struct window_pane *);
|
void window_copy_cursor_right(struct window_pane *);
|
||||||
void window_copy_cursor_up(struct window_pane *, int);
|
void window_copy_cursor_up(struct window_pane *, int);
|
||||||
@ -415,6 +416,10 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key)
|
|||||||
case MODEKEYCOPY_CANCEL:
|
case MODEKEYCOPY_CANCEL:
|
||||||
window_pane_reset_mode(wp);
|
window_pane_reset_mode(wp);
|
||||||
return;
|
return;
|
||||||
|
case MODEKEYCOPY_OTHEREND:
|
||||||
|
for (; np != 0; np--)
|
||||||
|
window_copy_other_end(wp);
|
||||||
|
break;
|
||||||
case MODEKEYCOPY_LEFT:
|
case MODEKEYCOPY_LEFT:
|
||||||
for (; np != 0; np--)
|
for (; np != 0; np--)
|
||||||
window_copy_cursor_left(wp);
|
window_copy_cursor_left(wp);
|
||||||
@ -1618,6 +1623,39 @@ window_copy_cursor_end_of_line(struct window_pane *wp)
|
|||||||
window_copy_redraw_lines(wp, data->cy, 1);
|
window_copy_redraw_lines(wp, data->cy, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
window_copy_other_end(struct window_pane *wp)
|
||||||
|
{
|
||||||
|
struct window_copy_mode_data *data = wp->modedata;
|
||||||
|
struct screen *s = &data->screen;
|
||||||
|
u_int selx, sely, cx, cy, yy;
|
||||||
|
|
||||||
|
if (!s->sel.flag)
|
||||||
|
return;
|
||||||
|
|
||||||
|
selx = data->selx;
|
||||||
|
sely = data->sely;
|
||||||
|
cx = data->cx;
|
||||||
|
cy = data->cy;
|
||||||
|
yy = screen_hsize(data->backing) + data->cy - data->oy;
|
||||||
|
|
||||||
|
data->selx = cx;
|
||||||
|
data->sely = yy;
|
||||||
|
data->cx = selx;
|
||||||
|
|
||||||
|
if (sely < screen_hsize(data->backing) - data->oy) {
|
||||||
|
data->oy = screen_hsize(data->backing) - sely;
|
||||||
|
data->cy = 0;
|
||||||
|
} else if (sely > screen_hsize(data->backing) - data->oy + screen_size_y(s)) {
|
||||||
|
data->oy = screen_hsize(data->backing) - sely + screen_size_y(s) - 1;
|
||||||
|
data->cy = screen_size_y(s) - 1;
|
||||||
|
|
||||||
|
} else
|
||||||
|
data->cy = cy + sely - yy;
|
||||||
|
|
||||||
|
window_copy_redraw_screen(wp);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
window_copy_cursor_left(struct window_pane *wp)
|
window_copy_cursor_left(struct window_pane *wp)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user