mirror of
https://github.com/tmux/tmux.git
synced 2024-12-24 18:38:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
563ed05353
@ -30,8 +30,8 @@ const struct cmd_entry cmd_copy_mode_entry = {
|
||||
.name = "copy-mode",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "deHMs:t:uq", 0, 0, NULL },
|
||||
.usage = "[-deHMuq] [-s src-pane] " CMD_TARGET_PANE_USAGE,
|
||||
.args = { "deHMqSs:t:u", 0, 0, NULL },
|
||||
.usage = "[-deHMqSu] [-s src-pane] " CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.source = { 's', CMD_FIND_PANE, 0 },
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
@ -92,7 +92,12 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (args_has(args, 'u'))
|
||||
window_copy_pageup(wp, 0);
|
||||
if (args_has(args, 'd'))
|
||||
window_copy_pagedown(wp, 0, args_has(args, 'e'));
|
||||
window_copy_pagedown(wp, 0, args_has(args, 'e'));
|
||||
if (args_has(args, 'S')) {
|
||||
window_copy_scroll(wp, c->tty.mouse_slider_mpos, event->m.y,
|
||||
args_has(args, 'e'));
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
@ -478,6 +478,11 @@ key_bindings_init(void)
|
||||
"bind -n MouseDown3Pane { if -Ft= '#{||:#{mouse_any_flag},#{&&:#{pane_in_mode},#{?#{m/r:(copy|view)-mode,#{pane_mode}},0,1}}}' { select-pane -t=; send -M } { display-menu -t= -xM -yM -T '#[align=centre]#{pane_index} (#{pane_id})' " DEFAULT_PANE_MENU " } }",
|
||||
"bind -n M-MouseDown3Pane { display-menu -t= -xM -yM -T '#[align=centre]#{pane_index} (#{pane_id})' " DEFAULT_PANE_MENU " }",
|
||||
|
||||
/* Mouse on scrollbar. */
|
||||
"bind -n MouseDown1ScrollbarUp { copy-mode -u }",
|
||||
"bind -n MouseDown1ScrollbarDown { copy-mode -d }",
|
||||
"bind -n MouseDrag1ScrollbarSlider { copy-mode -S }",
|
||||
|
||||
/* Copy mode (emacs) keys. */
|
||||
"bind -Tcopy-mode C-Space { send -X begin-selection }",
|
||||
"bind -Tcopy-mode C-a { send -X start-of-line }",
|
||||
|
@ -1005,6 +1005,10 @@ screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
|
||||
|
||||
screen_redraw_draw_scrollbar(ctx, wp, sb_pos, sb_x, sb_y, sb_h,
|
||||
slider_h, slider_y);
|
||||
|
||||
/* Store current position and height of the slider */
|
||||
wp->sb_slider_y = slider_y; /* top of slider y pos in scrollbar */
|
||||
wp->sb_slider_h = slider_h; /* height of slider */
|
||||
}
|
||||
|
||||
static void
|
||||
|
514
server-client.c
514
server-client.c
@ -572,10 +572,12 @@ server_client_check_mouse(struct client *c, struct key_event *event)
|
||||
{
|
||||
struct mouse_event *m = &event->m;
|
||||
struct session *s = c->session, *fs;
|
||||
struct options *wo = s->curw->window->options;
|
||||
struct winlink *fwl;
|
||||
struct window_pane *wp, *fwp;
|
||||
u_int x, y, b, sx, sy, px, py;
|
||||
int ignore = 0;
|
||||
u_int x, y, b, sx, sy, px, py, line = 0, sb_pos;
|
||||
u_int sl_top, sl_bottom, sl_mpos = 0;
|
||||
int ignore = 0, sb, sb_w, pane_status;
|
||||
key_code key;
|
||||
struct timeval tv;
|
||||
struct style_range *sr;
|
||||
@ -594,7 +596,10 @@ server_client_check_mouse(struct client *c, struct key_event *event)
|
||||
STATUS_LEFT,
|
||||
STATUS_RIGHT,
|
||||
STATUS_DEFAULT,
|
||||
BORDER } where = NOWHERE;
|
||||
BORDER,
|
||||
SCROLLBAR_UP,
|
||||
SCROLLBAR_SLIDER,
|
||||
SCROLLBAR_DOWN } where = NOWHERE;
|
||||
|
||||
log_debug("%s mouse %02x at %u,%u (last %u,%u) (%d)", c->name, m->b,
|
||||
m->x, m->y, m->lx, m->ly, c->tty.mouse_drag_flag);
|
||||
@ -743,54 +748,114 @@ have_event:
|
||||
}
|
||||
}
|
||||
|
||||
/* Not on status line. Adjust position and check for border or pane. */
|
||||
/*
|
||||
* Not on status line. Adjust position and check for border, pane, or
|
||||
* scrollbar.
|
||||
*/
|
||||
if (where == NOWHERE) {
|
||||
px = x;
|
||||
if (m->statusat == 0 && y >= m->statuslines)
|
||||
py = y - m->statuslines;
|
||||
else if (m->statusat > 0 && y >= (u_int)m->statusat)
|
||||
py = m->statusat - 1;
|
||||
else
|
||||
py = y;
|
||||
|
||||
tty_window_offset(&c->tty, &m->ox, &m->oy, &sx, &sy);
|
||||
log_debug("mouse window @%u at %u,%u (%ux%u)",
|
||||
s->curw->window->id, m->ox, m->oy, sx, sy);
|
||||
if (px > sx || py > sy)
|
||||
return (KEYC_UNKNOWN);
|
||||
px = px + m->ox;
|
||||
py = py + m->oy;
|
||||
|
||||
/* Try the pane borders if not zoomed. */
|
||||
if (~s->curw->window->flags & WINDOW_ZOOMED) {
|
||||
TAILQ_FOREACH(wp, &s->curw->window->panes, entry) {
|
||||
if ((wp->xoff + wp->sx == px &&
|
||||
wp->yoff <= 1 + py &&
|
||||
wp->yoff + wp->sy >= py) ||
|
||||
(wp->yoff + wp->sy == py &&
|
||||
wp->xoff <= 1 + px &&
|
||||
wp->xoff + wp->sx >= px))
|
||||
break;
|
||||
}
|
||||
if (wp != NULL)
|
||||
where = BORDER;
|
||||
}
|
||||
|
||||
/* Otherwise try inside the pane. */
|
||||
if (where == NOWHERE) {
|
||||
wp = window_get_active_at(s->curw->window, px, py);
|
||||
if (wp != NULL)
|
||||
where = PANE;
|
||||
if (c->tty.mouse_scrolling_flag)
|
||||
where = SCROLLBAR_SLIDER;
|
||||
else {
|
||||
px = x;
|
||||
if (m->statusat == 0 && y >= m->statuslines)
|
||||
py = y - m->statuslines;
|
||||
else if (m->statusat > 0 && y >= (u_int)m->statusat)
|
||||
py = m->statusat - 1;
|
||||
else
|
||||
py = y;
|
||||
|
||||
tty_window_offset(&c->tty, &m->ox, &m->oy, &sx, &sy);
|
||||
log_debug("mouse window @%u at %u,%u (%ux%u)",
|
||||
s->curw->window->id, m->ox, m->oy, sx, sy);
|
||||
if (px > sx || py > sy)
|
||||
return (KEYC_UNKNOWN);
|
||||
px = px + m->ox;
|
||||
py = py + m->oy;
|
||||
|
||||
/* Try inside the pane. */
|
||||
wp = window_get_active_at(s->curw->window, px, py);
|
||||
if (wp == NULL)
|
||||
return (KEYC_UNKNOWN);
|
||||
|
||||
/* Try the scrollbar next to a pane. */
|
||||
sb = options_get_number(wo, "pane-scrollbars");
|
||||
sb_pos = options_get_number(wo,
|
||||
"pane-scrollbars-position");
|
||||
if (sb == PANE_SCROLLBARS_ALWAYS ||
|
||||
(sb == PANE_SCROLLBARS_MODAL &&
|
||||
window_pane_mode(wp) != WINDOW_PANE_NO_MODE))
|
||||
sb_w = PANE_SCROLLBARS_WIDTH;
|
||||
else
|
||||
sb_w = 0;
|
||||
pane_status = options_get_number(wo,
|
||||
"pane-border-status");
|
||||
if (pane_status == PANE_STATUS_TOP)
|
||||
line = wp->yoff - 1;
|
||||
else if (pane_status == PANE_STATUS_BOTTOM)
|
||||
line = wp->yoff + wp->sy;
|
||||
|
||||
/*
|
||||
* Check if py could lie within a scrollbar. If the
|
||||
* pane is at the top, then py is 0; if not then the
|
||||
* top, then yoff to yoff + sy.
|
||||
*/
|
||||
if ((pane_status != PANE_STATUS_OFF && py != line) ||
|
||||
(wp->yoff == 0 && py < wp->sy) ||
|
||||
(py >= wp->yoff && py < wp->yoff + wp->sy)) {
|
||||
if ((sb_pos == PANE_SCROLLBARS_RIGHT &&
|
||||
(px >= wp->xoff + wp->sx &&
|
||||
px < wp->xoff + wp->sx + sb_w)) ||
|
||||
(sb_pos == PANE_SCROLLBARS_LEFT &&
|
||||
(px >= wp->xoff - sb_w &&
|
||||
px < wp->xoff))) {
|
||||
sl_top = wp->yoff + wp->sb_slider_y;
|
||||
sl_bottom = (wp->yoff +
|
||||
wp->sb_slider_y +
|
||||
wp->sb_slider_h - 1);
|
||||
if (py < sl_top)
|
||||
where = SCROLLBAR_UP;
|
||||
else if (py >= sl_top &&
|
||||
py <= sl_bottom) {
|
||||
where = SCROLLBAR_SLIDER;
|
||||
sl_mpos = (py -
|
||||
wp->sb_slider_y - wp->yoff);
|
||||
} else /* py > sl_bottom */
|
||||
where = SCROLLBAR_DOWN;
|
||||
} else
|
||||
where = PANE;
|
||||
} else {
|
||||
/* Try the pane borders if not zoomed. */
|
||||
if (~s->curw->window->flags & WINDOW_ZOOMED) {
|
||||
TAILQ_FOREACH(wp,
|
||||
&s->curw->window->panes, entry) {
|
||||
if ((wp->xoff + wp->sx == px &&
|
||||
wp->yoff <= 1 + py &&
|
||||
wp->yoff + wp->sy >= py) ||
|
||||
(wp->yoff + wp->sy == py &&
|
||||
wp->xoff <= 1 + px &&
|
||||
wp->xoff + wp->sx >= px))
|
||||
break;
|
||||
}
|
||||
if (wp != NULL)
|
||||
where = BORDER;
|
||||
}
|
||||
}
|
||||
if (where == PANE) {
|
||||
log_debug("mouse %u,%u on pane %%%u", x, y,
|
||||
wp->id);
|
||||
} else if (where == BORDER)
|
||||
log_debug("mouse on pane %%%u border", wp->id);
|
||||
else if (where == SCROLLBAR_UP ||
|
||||
where == SCROLLBAR_SLIDER ||
|
||||
where == SCROLLBAR_DOWN) {
|
||||
log_debug("mouse on pane %%%u scrollbar",
|
||||
wp->id);
|
||||
}
|
||||
m->wp = wp->id;
|
||||
m->w = wp->window->id;
|
||||
}
|
||||
if (where == PANE)
|
||||
log_debug("mouse %u,%u on pane %%%u", x, y, wp->id);
|
||||
else if (where == BORDER)
|
||||
log_debug("mouse on pane %%%u border", wp->id);
|
||||
m->wp = wp->id;
|
||||
m->w = wp->window->id;
|
||||
}
|
||||
} else
|
||||
m->wp = -1;
|
||||
|
||||
/* Stop dragging if needed. */
|
||||
if (type != DRAG && type != WHEEL && c->tty.mouse_drag_flag != 0) {
|
||||
@ -799,6 +864,7 @@ have_event:
|
||||
|
||||
c->tty.mouse_drag_update = NULL;
|
||||
c->tty.mouse_drag_release = NULL;
|
||||
c->tty.mouse_scrolling_flag = 0;
|
||||
|
||||
/*
|
||||
* End a mouse drag by passing a MouseDragEnd key corresponding
|
||||
@ -816,6 +882,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND1_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAGEND1_SCROLLBAR_SLIDER;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND1_BORDER;
|
||||
break;
|
||||
@ -830,6 +898,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND2_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAGEND2_SCROLLBAR_SLIDER;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND2_BORDER;
|
||||
break;
|
||||
@ -844,6 +914,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND3_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAGEND3_SCROLLBAR_SLIDER;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND3_BORDER;
|
||||
break;
|
||||
@ -858,6 +930,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND6_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND6_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAGEND6_SCROLLBAR_SLIDER;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND6_BORDER;
|
||||
break;
|
||||
@ -872,6 +946,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND7_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND7_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAGEND7_SCROLLBAR_SLIDER;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND7_BORDER;
|
||||
break;
|
||||
@ -886,6 +962,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND8_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND8_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAGEND8_SCROLLBAR_SLIDER;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND8_BORDER;
|
||||
break;
|
||||
@ -900,6 +978,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND9_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND9_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAGEND9_SCROLLBAR_SLIDER;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND9_BORDER;
|
||||
break;
|
||||
@ -914,6 +994,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND10_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND10_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAGEND10_SCROLLBAR_SLIDER;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND10_BORDER;
|
||||
break;
|
||||
@ -928,6 +1010,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND11_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND11_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAGEND11_SCROLLBAR_SLIDER;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND11_BORDER;
|
||||
break;
|
||||
@ -936,6 +1020,7 @@ have_event:
|
||||
break;
|
||||
}
|
||||
c->tty.mouse_drag_flag = 0;
|
||||
c->tty.mouse_slider_mpos = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -974,6 +1059,12 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG1_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDRAG1_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAG1_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDRAG1_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG1_BORDER;
|
||||
break;
|
||||
@ -988,6 +1079,12 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG2_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDRAG2_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAG2_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDRAG2_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG2_BORDER;
|
||||
break;
|
||||
@ -1002,6 +1099,12 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG3_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDRAG3_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAG3_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDRAG3_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG3_BORDER;
|
||||
break;
|
||||
@ -1016,6 +1119,12 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG6_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG6_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDRAG6_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAG6_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDRAG6_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG6_BORDER;
|
||||
break;
|
||||
@ -1030,6 +1139,12 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG7_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG7_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDRAG7_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAG7_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDRAG7_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG7_BORDER;
|
||||
break;
|
||||
@ -1044,6 +1159,12 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG8_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG8_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDRAG8_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAG8_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDRAG8_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG8_BORDER;
|
||||
break;
|
||||
@ -1058,6 +1179,12 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG9_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG9_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDRAG9_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAG9_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDRAG9_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG9_BORDER;
|
||||
break;
|
||||
@ -1072,6 +1199,12 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG10_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG10_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDRAG10_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAG10_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDRAG10_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG10_BORDER;
|
||||
break;
|
||||
@ -1086,6 +1219,12 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG11_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG11_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDRAG11_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDRAG11_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDRAG11_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG11_BORDER;
|
||||
break;
|
||||
@ -1094,9 +1233,16 @@ have_event:
|
||||
|
||||
/*
|
||||
* Begin a drag by setting the flag to a non-zero value that
|
||||
* corresponds to the mouse button in use.
|
||||
* corresponds to the mouse button in use. If starting to drag
|
||||
* the scrollbar, store the relative position in the slider
|
||||
* where the user grabbed.
|
||||
*/
|
||||
c->tty.mouse_drag_flag = MOUSE_BUTTONS(b) + 1;
|
||||
if (c->tty.mouse_scrolling_flag == 0 &&
|
||||
where == SCROLLBAR_SLIDER) {
|
||||
c->tty.mouse_scrolling_flag = 1;
|
||||
c->tty.mouse_slider_mpos = sl_mpos;
|
||||
}
|
||||
break;
|
||||
case WHEEL:
|
||||
if (MOUSE_BUTTONS(b) == MOUSE_WHEEL_UP) {
|
||||
@ -1140,6 +1286,12 @@ have_event:
|
||||
key = KEYC_MOUSEUP1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP1_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEUP1_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEUP1_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEUP1_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP1_BORDER;
|
||||
break;
|
||||
@ -1154,6 +1306,12 @@ have_event:
|
||||
key = KEYC_MOUSEUP2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP2_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEUP2_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEUP2_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEUP2_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP2_BORDER;
|
||||
break;
|
||||
@ -1168,6 +1326,12 @@ have_event:
|
||||
key = KEYC_MOUSEUP3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP3_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEUP3_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEUP3_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEUP3_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP3_BORDER;
|
||||
break;
|
||||
@ -1182,6 +1346,12 @@ have_event:
|
||||
key = KEYC_MOUSEUP6_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP6_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEUP6_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEUP6_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEUP6_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP6_BORDER;
|
||||
break;
|
||||
@ -1196,6 +1366,12 @@ have_event:
|
||||
key = KEYC_MOUSEUP7_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP7_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEUP7_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEUP7_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEUP7_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP7_BORDER;
|
||||
break;
|
||||
@ -1210,6 +1386,12 @@ have_event:
|
||||
key = KEYC_MOUSEUP8_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP8_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEUP8_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEUP8_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEUP8_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP8_BORDER;
|
||||
break;
|
||||
@ -1224,6 +1406,12 @@ have_event:
|
||||
key = KEYC_MOUSEUP9_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP9_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEUP9_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEUP9_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEUP9_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP9_BORDER;
|
||||
break;
|
||||
@ -1237,7 +1425,13 @@ have_event:
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEUP1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP1_STATUS_DEFAULT;
|
||||
key = KEYC_MOUSEUP10_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEUP10_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEUP10_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEUP1_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP1_BORDER;
|
||||
break;
|
||||
@ -1252,6 +1446,12 @@ have_event:
|
||||
key = KEYC_MOUSEUP11_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP11_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEUP11_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEUP11_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEUP11_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP11_BORDER;
|
||||
break;
|
||||
@ -1270,6 +1470,12 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN1_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDOWN1_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDOWN1_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDOWN1_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN1_BORDER;
|
||||
break;
|
||||
@ -1284,6 +1490,12 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN2_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDOWN2_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDOWN2_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDOWN2_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN2_BORDER;
|
||||
break;
|
||||
@ -1298,6 +1510,12 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN3_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDOWN3_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDOWN3_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDOWN3_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN3_BORDER;
|
||||
break;
|
||||
@ -1312,6 +1530,12 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN6_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN6_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDOWN6_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDOWN6_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDOWN6_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN6_BORDER;
|
||||
break;
|
||||
@ -1326,6 +1550,12 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN7_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN7_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDOWN7_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDOWN7_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDOWN7_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN7_BORDER;
|
||||
break;
|
||||
@ -1340,6 +1570,12 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN8_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN8_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDOWN8_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDOWN8_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDOWN8_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN8_BORDER;
|
||||
break;
|
||||
@ -1354,6 +1590,12 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN9_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN9_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDOWN9_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDOWN9_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDOWN9_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN9_BORDER;
|
||||
break;
|
||||
@ -1368,6 +1610,12 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN10_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN10_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDOWN10_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDOWN10_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDOWN10_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN10_BORDER;
|
||||
break;
|
||||
@ -1382,6 +1630,12 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN11_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN11_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_MOUSEDOWN11_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_MOUSEDOWN11_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_MOUSEDOWN11_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN11_BORDER;
|
||||
break;
|
||||
@ -1400,6 +1654,12 @@ have_event:
|
||||
key = KEYC_SECONDCLICK1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_SECONDCLICK1_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_SECONDCLICK1_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_SECONDCLICK1_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_SECONDCLICK1_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_SECONDCLICK1_BORDER;
|
||||
break;
|
||||
@ -1414,6 +1674,12 @@ have_event:
|
||||
key = KEYC_SECONDCLICK2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_SECONDCLICK2_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_SECONDCLICK2_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_SECONDCLICK2_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_SECONDCLICK2_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_SECONDCLICK2_BORDER;
|
||||
break;
|
||||
@ -1428,6 +1694,12 @@ have_event:
|
||||
key = KEYC_SECONDCLICK3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_SECONDCLICK3_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_SECONDCLICK3_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_SECONDCLICK3_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_SECONDCLICK3_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_SECONDCLICK3_BORDER;
|
||||
break;
|
||||
@ -1442,6 +1714,12 @@ have_event:
|
||||
key = KEYC_SECONDCLICK6_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_SECONDCLICK6_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_SECONDCLICK6_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_SECONDCLICK6_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_SECONDCLICK6_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_SECONDCLICK6_BORDER;
|
||||
break;
|
||||
@ -1456,6 +1734,12 @@ have_event:
|
||||
key = KEYC_SECONDCLICK7_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_SECONDCLICK7_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_SECONDCLICK7_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_SECONDCLICK7_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_SECONDCLICK7_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_SECONDCLICK7_BORDER;
|
||||
break;
|
||||
@ -1470,6 +1754,12 @@ have_event:
|
||||
key = KEYC_SECONDCLICK8_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_SECONDCLICK8_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_SECONDCLICK8_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_SECONDCLICK8_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_SECONDCLICK8_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_SECONDCLICK8_BORDER;
|
||||
break;
|
||||
@ -1484,6 +1774,12 @@ have_event:
|
||||
key = KEYC_SECONDCLICK9_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_SECONDCLICK9_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_SECONDCLICK9_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_SECONDCLICK9_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_SECONDCLICK9_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_SECONDCLICK9_BORDER;
|
||||
break;
|
||||
@ -1498,6 +1794,12 @@ have_event:
|
||||
key = KEYC_SECONDCLICK10_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_SECONDCLICK10_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_SECONDCLICK10_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_SECONDCLICK10_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_SECONDCLICK10_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_SECONDCLICK10_BORDER;
|
||||
break;
|
||||
@ -1512,6 +1814,12 @@ have_event:
|
||||
key = KEYC_SECONDCLICK11_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_SECONDCLICK11_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_SECONDCLICK11_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_SECONDCLICK11_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_SECONDCLICK11_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_SECONDCLICK11_BORDER;
|
||||
break;
|
||||
@ -1530,6 +1838,12 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK1_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_DOUBLECLICK1_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_DOUBLECLICK1_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_DOUBLECLICK1_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK1_BORDER;
|
||||
break;
|
||||
@ -1544,6 +1858,12 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK2_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_DOUBLECLICK2_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_DOUBLECLICK2_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_DOUBLECLICK2_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK2_BORDER;
|
||||
break;
|
||||
@ -1558,6 +1878,12 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK3_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_DOUBLECLICK3_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_DOUBLECLICK3_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_DOUBLECLICK3_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK3_BORDER;
|
||||
break;
|
||||
@ -1572,6 +1898,12 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK6_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK6_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_DOUBLECLICK6_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_DOUBLECLICK6_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_DOUBLECLICK6_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK6_BORDER;
|
||||
break;
|
||||
@ -1586,6 +1918,12 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK7_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK7_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_DOUBLECLICK7_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_DOUBLECLICK7_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_DOUBLECLICK7_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK7_BORDER;
|
||||
break;
|
||||
@ -1600,6 +1938,12 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK8_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK8_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_DOUBLECLICK8_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_DOUBLECLICK8_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_DOUBLECLICK8_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK8_BORDER;
|
||||
break;
|
||||
@ -1614,6 +1958,12 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK9_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK9_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_DOUBLECLICK9_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_DOUBLECLICK9_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_DOUBLECLICK9_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK9_BORDER;
|
||||
break;
|
||||
@ -1628,6 +1978,12 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK10_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK10_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_DOUBLECLICK10_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_DOUBLECLICK10_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_DOUBLECLICK10_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK10_BORDER;
|
||||
break;
|
||||
@ -1642,6 +1998,12 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK11_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK11_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_DOUBLECLICK11_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_DOUBLECLICK11_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_DOUBLECLICK11_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK11_BORDER;
|
||||
break;
|
||||
@ -1660,6 +2022,12 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK1_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_TRIPLECLICK1_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_TRIPLECLICK1_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_TRIPLECLICK1_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK1_BORDER;
|
||||
break;
|
||||
@ -1674,6 +2042,12 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK2_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_TRIPLECLICK2_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_TRIPLECLICK2_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_TRIPLECLICK2_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK2_BORDER;
|
||||
break;
|
||||
@ -1688,6 +2062,12 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK3_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_TRIPLECLICK3_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_TRIPLECLICK3_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_TRIPLECLICK3_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK3_BORDER;
|
||||
break;
|
||||
@ -1702,6 +2082,12 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK6_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK6_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_TRIPLECLICK6_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_TRIPLECLICK6_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_TRIPLECLICK6_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK6_BORDER;
|
||||
break;
|
||||
@ -1716,6 +2102,12 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK7_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK7_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_TRIPLECLICK7_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_TRIPLECLICK7_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_TRIPLECLICK7_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK7_BORDER;
|
||||
break;
|
||||
@ -1730,6 +2122,12 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK8_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK8_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_TRIPLECLICK8_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_TRIPLECLICK8_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_TRIPLECLICK8_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK8_BORDER;
|
||||
break;
|
||||
@ -1744,6 +2142,12 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK9_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK9_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_TRIPLECLICK9_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_TRIPLECLICK9_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_TRIPLECLICK9_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK9_BORDER;
|
||||
break;
|
||||
@ -1758,6 +2162,12 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK10_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK10_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_TRIPLECLICK10_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_TRIPLECLICK10_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_TRIPLECLICK10_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK10_BORDER;
|
||||
break;
|
||||
@ -1772,6 +2182,12 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK11_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK11_STATUS_DEFAULT;
|
||||
if (where == SCROLLBAR_UP)
|
||||
key = KEYC_TRIPLECLICK11_SCROLLBAR_UP;
|
||||
if (where == SCROLLBAR_SLIDER)
|
||||
key = KEYC_TRIPLECLICK11_SCROLLBAR_SLIDER;
|
||||
if (where == SCROLLBAR_DOWN)
|
||||
key = KEYC_TRIPLECLICK11_SCROLLBAR_DOWN;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK11_BORDER;
|
||||
break;
|
||||
|
24
tmux.1
24
tmux.1
@ -2402,22 +2402,31 @@ The synopsis for the
|
||||
command is:
|
||||
.Bl -tag -width Ds
|
||||
.It Xo Ic copy-mode
|
||||
.Op Fl deHMqu
|
||||
.Op Fl deHMqSu
|
||||
.Op Fl s Ar src-pane
|
||||
.Op Fl t Ar target-pane
|
||||
.Xc
|
||||
Enter copy mode.
|
||||
.Pp
|
||||
.Fl u
|
||||
also scrolls one page up after entering and
|
||||
enters copy mode and scrolls one page up and
|
||||
.Fl d
|
||||
one page down if already in copy mode.
|
||||
.Fl M
|
||||
begins a mouse drag (only valid if bound to a mouse key binding, see
|
||||
.Sx MOUSE SUPPORT ) .
|
||||
one page down.
|
||||
.Fl H
|
||||
hides the position indicator in the top right.
|
||||
.Fl q
|
||||
cancels copy mode and any other modes.
|
||||
.Pp
|
||||
.Fl M
|
||||
begins a mouse drag (only valid if bound to a mouse key binding, see
|
||||
.Sx MOUSE SUPPORT ) .
|
||||
.Fl S
|
||||
scrolls when bound to a mouse drag event; for example,
|
||||
.Ic copy-mode -Se
|
||||
is bound to
|
||||
.Ar MouseDrag1ScrollbarSlider
|
||||
by default.
|
||||
.Pp
|
||||
.Fl s
|
||||
copies from
|
||||
.Ar src-pane
|
||||
@ -5443,6 +5452,9 @@ and a location suffix, one of the following:
|
||||
.It Li "StatusLeft" Ta "the left part of the status line"
|
||||
.It Li "StatusRight" Ta "the right part of the status line"
|
||||
.It Li "StatusDefault" Ta "any other part of the status line"
|
||||
.It Li "ScrollbarSlider" Ta "the scrollbar slider"
|
||||
.It Li "ScrollbarUp" Ta "above the scrollbar slider"
|
||||
.It Li "ScrollbarDown" Ta "below the scrollbar slider"
|
||||
.El
|
||||
.Pp
|
||||
The following mouse events are available:
|
||||
|
37
tmux.h
37
tmux.h
@ -178,19 +178,25 @@ struct winlink;
|
||||
#define KEYC_CLICK_TIMEOUT 300
|
||||
|
||||
/* Mouse key codes. */
|
||||
#define KEYC_MOUSE_KEY(name) \
|
||||
KEYC_ ## name ## _PANE, \
|
||||
KEYC_ ## name ## _STATUS, \
|
||||
KEYC_ ## name ## _STATUS_LEFT, \
|
||||
KEYC_ ## name ## _STATUS_RIGHT, \
|
||||
KEYC_ ## name ## _STATUS_DEFAULT, \
|
||||
#define KEYC_MOUSE_KEY(name) \
|
||||
KEYC_ ## name ## _PANE, \
|
||||
KEYC_ ## name ## _STATUS, \
|
||||
KEYC_ ## name ## _STATUS_LEFT, \
|
||||
KEYC_ ## name ## _STATUS_RIGHT, \
|
||||
KEYC_ ## name ## _STATUS_DEFAULT, \
|
||||
KEYC_ ## name ## _SCROLLBAR_UP, \
|
||||
KEYC_ ## name ## _SCROLLBAR_SLIDER, \
|
||||
KEYC_ ## name ## _SCROLLBAR_DOWN, \
|
||||
KEYC_ ## name ## _BORDER
|
||||
#define KEYC_MOUSE_STRING(name, s) \
|
||||
{ #s "Pane", KEYC_ ## name ## _PANE }, \
|
||||
{ #s "Status", KEYC_ ## name ## _STATUS }, \
|
||||
{ #s "StatusLeft", KEYC_ ## name ## _STATUS_LEFT }, \
|
||||
{ #s "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \
|
||||
{ #s "StatusDefault", KEYC_ ## name ## _STATUS_DEFAULT }, \
|
||||
#define KEYC_MOUSE_STRING(name, s) \
|
||||
{ #s "Pane", KEYC_ ## name ## _PANE }, \
|
||||
{ #s "Status", KEYC_ ## name ## _STATUS }, \
|
||||
{ #s "StatusLeft", KEYC_ ## name ## _STATUS_LEFT }, \
|
||||
{ #s "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \
|
||||
{ #s "StatusDefault", KEYC_ ## name ## _STATUS_DEFAULT }, \
|
||||
{ #s "ScrollbarUp", KEYC_ ## name ## _SCROLLBAR_UP }, \
|
||||
{ #s "ScrollbarSlider", KEYC_ ## name ## _SCROLLBAR_SLIDER }, \
|
||||
{ #s "ScrollbarDown", KEYC_ ## name ## _SCROLLBAR_DOWN }, \
|
||||
{ #s "Border", KEYC_ ## name ## _BORDER }
|
||||
|
||||
/*
|
||||
@ -1140,6 +1146,9 @@ struct window_pane {
|
||||
#define PANE_UNSEENCHANGES 0x2000
|
||||
#define PANE_REDRAWSCROLLBAR 0x4000
|
||||
|
||||
u_int sb_slider_y;
|
||||
u_int sb_slider_h;
|
||||
|
||||
int argc;
|
||||
char **argv;
|
||||
char *shell;
|
||||
@ -1543,6 +1552,9 @@ struct tty {
|
||||
u_int mouse_last_y;
|
||||
u_int mouse_last_b;
|
||||
int mouse_drag_flag;
|
||||
int mouse_scrolling_flag;
|
||||
int mouse_slider_mpos;
|
||||
|
||||
void (*mouse_drag_update)(struct client *,
|
||||
struct mouse_event *);
|
||||
void (*mouse_drag_release)(struct client *,
|
||||
@ -3314,6 +3326,7 @@ void printflike(3, 4) window_copy_add(struct window_pane *, int, const char *,
|
||||
...);
|
||||
void printflike(3, 0) window_copy_vadd(struct window_pane *, int, const char *,
|
||||
va_list);
|
||||
void window_copy_scroll(struct window_pane *, int, u_int, int);
|
||||
void window_copy_pageup(struct window_pane *, int);
|
||||
void window_copy_pagedown(struct window_pane *, int, int);
|
||||
void window_copy_start_drag(struct client *, struct mouse_event *);
|
||||
|
178
window-copy.c
178
window-copy.c
@ -40,6 +40,8 @@ static void window_copy_free(struct window_mode_entry *);
|
||||
static void window_copy_resize(struct window_mode_entry *, u_int, u_int);
|
||||
static void window_copy_formats(struct window_mode_entry *,
|
||||
struct format_tree *);
|
||||
static void window_copy_scroll1(struct window_mode_entry *,
|
||||
struct window_pane *wp, int, u_int, int);
|
||||
static void window_copy_pageup1(struct window_mode_entry *, int);
|
||||
static int window_copy_pagedown1(struct window_mode_entry *, int, int);
|
||||
static void window_copy_next_paragraph(struct window_mode_entry *);
|
||||
@ -145,6 +147,9 @@ static void window_copy_acquire_cursor_up(struct window_mode_entry *,
|
||||
u_int, u_int, u_int, u_int, u_int);
|
||||
static void window_copy_acquire_cursor_down(struct window_mode_entry *,
|
||||
u_int, u_int, u_int, u_int, u_int, u_int, int);
|
||||
static u_int window_copy_clip_width(u_int, u_int, u_int, u_int);
|
||||
static u_int window_copy_search_mark_match(struct window_copy_mode_data *,
|
||||
u_int , u_int, u_int, int);
|
||||
|
||||
const struct window_mode window_copy_mode = {
|
||||
.name = "copy-mode",
|
||||
@ -598,6 +603,113 @@ window_copy_vadd(struct window_pane *wp, int parse, const char *fmt, va_list ap)
|
||||
screen_write_stop(&ctx);
|
||||
}
|
||||
|
||||
void
|
||||
window_copy_scroll(struct window_pane *wp, int sl_mpos, u_int my,
|
||||
int scroll_exit)
|
||||
{
|
||||
struct window_mode_entry *wme = TAILQ_FIRST(&wp->modes);
|
||||
|
||||
if (wme != NULL) {
|
||||
window_set_active_pane(wp->window, wp, 0);
|
||||
window_copy_scroll1(wme, wp, sl_mpos, my, scroll_exit);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
window_copy_scroll1(struct window_mode_entry *wme, struct window_pane *wp,
|
||||
int sl_mpos, u_int my, int scroll_exit)
|
||||
{
|
||||
struct window_copy_mode_data *data = wme->data;
|
||||
u_int ox, oy, px, py, n, offset, size;
|
||||
u_int new_offset;
|
||||
u_int slider_height = wp->sb_slider_h;
|
||||
u_int sb_height = wp->sy, sb_top = wp->yoff;
|
||||
u_int sy = screen_size_y(data->backing);
|
||||
int new_slider_y, delta;
|
||||
|
||||
/*
|
||||
* sl_mpos is where in the slider the user is dragging, mouse is
|
||||
* dragging this y point relative to top of slider.
|
||||
*/
|
||||
if (my <= sb_top + sl_mpos) {
|
||||
/* Slider banged into top. */
|
||||
new_slider_y = sb_top - wp->yoff;
|
||||
} else if (my - sl_mpos > sb_top + sb_height - slider_height) {
|
||||
/* Slider banged into bottom. */
|
||||
new_slider_y = sb_top - wp->yoff + (sb_height - slider_height);
|
||||
} else {
|
||||
/* Slider is somewhere in the middle. */
|
||||
new_slider_y = my - wp->yoff - sl_mpos + 1;
|
||||
}
|
||||
|
||||
if (TAILQ_FIRST(&wp->modes) == NULL ||
|
||||
window_copy_get_current_offset(wp, &offset, &size) == 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* See screen_redraw_draw_pane_scrollbar - this is the inverse of the
|
||||
* formula used there.
|
||||
*/
|
||||
new_offset = new_slider_y * ((float)(size + sb_height) / sb_height);
|
||||
delta = (int)offset - new_offset;
|
||||
|
||||
/*
|
||||
* Move pane view around based on delta relative to the cursor,
|
||||
* maintaining the selection.
|
||||
*/
|
||||
oy = screen_hsize(data->backing) + data->cy - data->oy;
|
||||
ox = window_copy_find_length(wme, oy);
|
||||
|
||||
if (data->cx != ox) {
|
||||
data->lastcx = data->cx;
|
||||
data->lastsx = ox;
|
||||
}
|
||||
data->cx = data->lastcx;
|
||||
|
||||
if (delta >= 0) {
|
||||
n = (u_int)delta;
|
||||
if (data->oy + n > screen_hsize(data->backing)) {
|
||||
data->oy = screen_hsize(data->backing);
|
||||
if (data->cy < n)
|
||||
data->cy = 0;
|
||||
else
|
||||
data->cy -= n;
|
||||
} else
|
||||
data->oy += n;
|
||||
} else {
|
||||
n = (u_int)-delta;
|
||||
if (data->oy < n) {
|
||||
data->oy = 0;
|
||||
if (data->cy + (n - data->oy) >= sy)
|
||||
data->cy = sy - 1;
|
||||
else
|
||||
data->cy += n - data->oy;
|
||||
} else
|
||||
data->oy -= n;
|
||||
}
|
||||
|
||||
/* Don't also drag tail when dragging a scrollbar, it looks weird. */
|
||||
data->cursordrag = CURSORDRAG_NONE;
|
||||
|
||||
if (data->screen.sel == NULL || !data->rectflag) {
|
||||
py = screen_hsize(data->backing) + data->cy - data->oy;
|
||||
px = window_copy_find_length(wme, py);
|
||||
if ((data->cx >= data->lastsx && data->cx != px) ||
|
||||
data->cx > px)
|
||||
window_copy_cursor_end_of_line(wme);
|
||||
}
|
||||
|
||||
if (scroll_exit && data->oy == 0) {
|
||||
window_pane_reset_mode(wp);
|
||||
return;
|
||||
}
|
||||
|
||||
if (data->searchmark != NULL && !data->timeout)
|
||||
window_copy_search_marks(wme, NULL, data->searchregex, 1);
|
||||
window_copy_update_selection(wme, 1, 0);
|
||||
window_copy_redraw_screen(wme);
|
||||
}
|
||||
|
||||
void
|
||||
window_copy_pageup(struct window_pane *wp, int half_page)
|
||||
{
|
||||
@ -3881,6 +3993,43 @@ window_copy_search_mark_at(struct window_copy_mode_data *data, u_int px,
|
||||
return (0);
|
||||
}
|
||||
|
||||
static u_int
|
||||
window_copy_clip_width(u_int width, u_int b, u_int sx, u_int sy)
|
||||
{
|
||||
return ((b + width > sx * sy) ? (sx * sy) - b : width);
|
||||
}
|
||||
|
||||
static u_int
|
||||
window_copy_search_mark_match(struct window_copy_mode_data *data, u_int px,
|
||||
u_int py, u_int width, int regex)
|
||||
{
|
||||
struct grid *gd = data->backing->grid;
|
||||
struct grid_cell gc;
|
||||
u_int i, b, w = width, sx = gd->sx, sy = gd->sy;
|
||||
|
||||
if (window_copy_search_mark_at(data, px, py, &b) == 0) {
|
||||
width = window_copy_clip_width(width, b, sx, sy);
|
||||
w = width;
|
||||
for (i = b; i < b + w; i++) {
|
||||
if (!regex) {
|
||||
grid_get_cell(gd, px + (i - b), py, &gc);
|
||||
if (gc.flags & GRID_FLAG_TAB)
|
||||
w += gc.data.width - 1;
|
||||
w = window_copy_clip_width(w, b, sx, sy);
|
||||
}
|
||||
if (data->searchmark[i] != 0)
|
||||
continue;
|
||||
data->searchmark[i] = data->searchgen;
|
||||
}
|
||||
if (data->searchgen == UCHAR_MAX)
|
||||
data->searchgen = 1;
|
||||
else
|
||||
data->searchgen++;
|
||||
}
|
||||
|
||||
return (w);
|
||||
}
|
||||
|
||||
static int
|
||||
window_copy_search_marks(struct window_mode_entry *wme, struct screen *ssp,
|
||||
int regex, int visible_only)
|
||||
@ -3892,7 +4041,7 @@ window_copy_search_marks(struct window_mode_entry *wme, struct screen *ssp,
|
||||
struct grid_cell gc;
|
||||
int found, cis, stopped = 0;
|
||||
int cflags = REG_EXTENDED;
|
||||
u_int px, py, i, b, nfound = 0, width, tw;
|
||||
u_int px, py, nfound = 0, width;
|
||||
u_int ssize = 1, start, end, sx = gd->sx;
|
||||
u_int sy = gd->sy;
|
||||
char *sbuf;
|
||||
@ -3958,31 +4107,8 @@ again:
|
||||
break;
|
||||
}
|
||||
nfound++;
|
||||
|
||||
tw = width;
|
||||
if (window_copy_search_mark_at(data, px, py, &b) == 0) {
|
||||
if (b + width > sx * sy)
|
||||
width = (sx * sy) - b;
|
||||
tw = width;
|
||||
for (i = b; i < b + tw; i++) {
|
||||
if (!regex) {
|
||||
grid_get_cell(gd, px + (i - b),
|
||||
py, &gc);
|
||||
if (gc.flags & GRID_FLAG_TAB)
|
||||
tw += gc.data.width - 1;
|
||||
if (b + tw > sx * sy)
|
||||
tw = (sx * sy) - b;
|
||||
}
|
||||
if (data->searchmark[i] != 0)
|
||||
continue;
|
||||
data->searchmark[i] = data->searchgen;
|
||||
}
|
||||
if (data->searchgen == UCHAR_MAX)
|
||||
data->searchgen = 1;
|
||||
else
|
||||
data->searchgen++;
|
||||
}
|
||||
px += tw;
|
||||
px += window_copy_search_mark_match(data, px, py, width,
|
||||
regex);
|
||||
}
|
||||
|
||||
t = get_timer();
|
||||
|
Loading…
Reference in New Issue
Block a user