mirror of
https://github.com/tmux/tmux.git
synced 2026-10-15 07:44:24 +00:00
Make pane scrollbars able to auto-hide after a short timeout. This
replaces the previous "modal" behaviour where the pane would be resized, which tended to make a mess. Instead, the scrollbar appears when scrolling or when hovered over with the mouse and disappears a (configurable) short period later. From Michael Grant.
This commit is contained in:
@@ -61,8 +61,10 @@ static int window_copy_line_number_mode(struct window_mode_entry *);
|
||||
static int window_copy_line_number_is_absolute(struct window_mode_entry *);
|
||||
static int window_copy_line_numbers_active(struct window_mode_entry *);
|
||||
static u_int window_copy_line_number_width(struct window_mode_entry *);
|
||||
static u_int window_copy_cursor_offset(struct window_mode_entry *, u_int, u_int);
|
||||
static u_int window_copy_cursor_unoffset(struct window_mode_entry *, u_int, u_int);
|
||||
static u_int window_copy_cursor_offset(struct window_mode_entry *, u_int,
|
||||
u_int);
|
||||
static u_int window_copy_cursor_unoffset(struct window_mode_entry *, u_int,
|
||||
u_int);
|
||||
static void window_copy_write_line(struct window_mode_entry *,
|
||||
struct screen_write_ctx *, u_int);
|
||||
static void window_copy_write_lines(struct window_mode_entry *,
|
||||
@@ -860,6 +862,7 @@ window_copy_scroll1(struct window_mode_entry *wme, struct window_pane *wp,
|
||||
if (data->searchmark != NULL && !data->timeout)
|
||||
window_copy_search_marks(wme, NULL, data->searchregex, 1);
|
||||
window_copy_update_selection(wme, 1, 0);
|
||||
window_pane_scrollbar_show(wp, 1);
|
||||
window_copy_redraw_screen(wme);
|
||||
}
|
||||
|
||||
@@ -913,6 +916,7 @@ window_copy_pageup1(struct window_mode_entry *wme, int half_page)
|
||||
if (data->searchmark != NULL && !data->timeout)
|
||||
window_copy_search_marks(wme, NULL, data->searchregex, 1);
|
||||
window_copy_update_selection(wme, 1, 0);
|
||||
window_pane_scrollbar_show(wme->wp, 1);
|
||||
window_copy_redraw_screen(wme);
|
||||
}
|
||||
|
||||
@@ -973,6 +977,7 @@ window_copy_pagedown1(struct window_mode_entry *wme, int half_page,
|
||||
if (data->searchmark != NULL && !data->timeout)
|
||||
window_copy_search_marks(wme, NULL, data->searchregex, 1);
|
||||
window_copy_update_selection(wme, 1, 0);
|
||||
window_pane_scrollbar_show(wme->wp, 1);
|
||||
window_copy_redraw_screen(wme);
|
||||
return (0);
|
||||
}
|
||||
@@ -1789,7 +1794,7 @@ window_copy_cmd_history_bottom(struct window_copy_cmd_state *cs)
|
||||
struct window_mode_entry *wme = cs->wme;
|
||||
struct window_copy_mode_data *data = wme->data;
|
||||
struct screen *s = data->backing;
|
||||
u_int oy;
|
||||
u_int oy, old_oy = data->oy;
|
||||
|
||||
oy = screen_hsize(s) + data->cy - data->oy;
|
||||
if (data->lineflag == LINE_SEL_RIGHT_LEFT && oy == data->endsely)
|
||||
@@ -1802,6 +1807,8 @@ window_copy_cmd_history_bottom(struct window_copy_cmd_state *cs)
|
||||
if (data->searchmark != NULL && !data->timeout)
|
||||
window_copy_search_marks(wme, NULL, data->searchregex, 1);
|
||||
window_copy_update_selection(wme, 1, 0);
|
||||
if (data->oy != old_oy)
|
||||
window_pane_scrollbar_show(wme->wp, 1);
|
||||
return (WINDOW_COPY_CMD_REDRAW);
|
||||
}
|
||||
|
||||
@@ -1810,7 +1817,7 @@ window_copy_cmd_history_top(struct window_copy_cmd_state *cs)
|
||||
{
|
||||
struct window_mode_entry *wme = cs->wme;
|
||||
struct window_copy_mode_data *data = wme->data;
|
||||
u_int oy;
|
||||
u_int oy, old_oy = data->oy;
|
||||
|
||||
oy = screen_hsize(data->backing) + data->cy - data->oy;
|
||||
if (data->lineflag == LINE_SEL_LEFT_RIGHT && oy == data->sely)
|
||||
@@ -1823,6 +1830,8 @@ window_copy_cmd_history_top(struct window_copy_cmd_state *cs)
|
||||
if (data->searchmark != NULL && !data->timeout)
|
||||
window_copy_search_marks(wme, NULL, data->searchregex, 1);
|
||||
window_copy_update_selection(wme, 1, 0);
|
||||
if (data->oy != old_oy)
|
||||
window_pane_scrollbar_show(wme->wp, 1);
|
||||
return (WINDOW_COPY_CMD_REDRAW);
|
||||
}
|
||||
|
||||
@@ -3772,7 +3781,7 @@ window_copy_scroll_to(struct window_mode_entry *wme, u_int px, u_int py,
|
||||
{
|
||||
struct window_copy_mode_data *data = wme->data;
|
||||
struct grid *gd = data->backing->grid;
|
||||
u_int offset, gap;
|
||||
u_int offset, gap, old_oy = data->oy;
|
||||
|
||||
data->cx = px;
|
||||
|
||||
@@ -3796,6 +3805,8 @@ window_copy_scroll_to(struct window_mode_entry *wme, u_int px, u_int py,
|
||||
if (!no_redraw && data->searchmark != NULL && !data->timeout)
|
||||
window_copy_search_marks(wme, NULL, data->searchregex, 1);
|
||||
window_copy_update_selection(wme, 1, 0);
|
||||
if (data->oy != old_oy)
|
||||
window_pane_scrollbar_show(wme->wp, 1);
|
||||
if (!no_redraw)
|
||||
window_copy_redraw_screen(wme);
|
||||
}
|
||||
@@ -5278,7 +5289,10 @@ window_copy_redraw_lines(struct window_mode_entry *wme, u_int py, u_int ny)
|
||||
return;
|
||||
}
|
||||
|
||||
screen_write_start_pane(&ctx, wp, NULL);
|
||||
if (window_pane_scrollbar_overlay_visible(wp))
|
||||
screen_write_start(&ctx, &data->screen);
|
||||
else
|
||||
screen_write_start_pane(&ctx, wp, NULL);
|
||||
for (i = py; i < py + ny; i++)
|
||||
window_copy_write_line(wme, &ctx, i);
|
||||
screen_write_cursormove(&ctx,
|
||||
@@ -5286,7 +5300,7 @@ window_copy_redraw_lines(struct window_mode_entry *wme, u_int py, u_int ny)
|
||||
0);
|
||||
screen_write_stop(&ctx);
|
||||
|
||||
wp->flags |= PANE_REDRAWSCROLLBAR;
|
||||
window_pane_scrollbar_redraw(wp);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -6542,6 +6556,7 @@ window_copy_scroll_up(struct window_mode_entry *wme, u_int ny)
|
||||
if (ny == 0)
|
||||
return;
|
||||
data->oy -= ny;
|
||||
window_pane_scrollbar_show(wp, 1);
|
||||
|
||||
if (data->searchmark != NULL && !data->timeout)
|
||||
window_copy_search_marks(wme, NULL, data->searchregex, 1);
|
||||
@@ -6573,7 +6588,10 @@ window_copy_scroll_up(struct window_mode_entry *wme, u_int ny)
|
||||
return;
|
||||
}
|
||||
|
||||
screen_write_start_pane(&ctx, wp, NULL);
|
||||
if (window_pane_scrollbar_overlay_visible(wp))
|
||||
screen_write_start(&ctx, &data->screen);
|
||||
else
|
||||
screen_write_start_pane(&ctx, wp, NULL);
|
||||
screen_write_cursormove(&ctx, 0, 0, 0);
|
||||
screen_write_deleteline(&ctx, ny, 8);
|
||||
window_copy_write_lines(wme, &ctx, screen_size_y(s) - ny, ny);
|
||||
@@ -6588,7 +6606,7 @@ window_copy_scroll_up(struct window_mode_entry *wme, u_int ny)
|
||||
window_copy_cursor_offset(wme, data->cx, screen_size_x(s)), data->cy,
|
||||
0);
|
||||
screen_write_stop(&ctx);
|
||||
wp->flags |= PANE_REDRAWSCROLLBAR;
|
||||
window_pane_scrollbar_redraw(wp);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -6607,6 +6625,7 @@ window_copy_scroll_down(struct window_mode_entry *wme, u_int ny)
|
||||
if (ny == 0)
|
||||
return;
|
||||
data->oy += ny;
|
||||
window_pane_scrollbar_show(wp, 1);
|
||||
|
||||
if (data->searchmark != NULL && !data->timeout)
|
||||
window_copy_search_marks(wme, NULL, data->searchregex, 1);
|
||||
@@ -6633,7 +6652,10 @@ window_copy_scroll_down(struct window_mode_entry *wme, u_int ny)
|
||||
return;
|
||||
}
|
||||
|
||||
screen_write_start_pane(&ctx, wp, NULL);
|
||||
if (window_pane_scrollbar_overlay_visible(wp))
|
||||
screen_write_start(&ctx, &data->screen);
|
||||
else
|
||||
screen_write_start_pane(&ctx, wp, NULL);
|
||||
screen_write_cursormove(&ctx, 0, 0, 0);
|
||||
screen_write_insertline(&ctx, ny, 8);
|
||||
window_copy_write_lines(wme, &ctx, 0, ny);
|
||||
@@ -6644,7 +6666,7 @@ window_copy_scroll_down(struct window_mode_entry *wme, u_int ny)
|
||||
screen_write_cursormove(&ctx, window_copy_cursor_offset(wme, data->cx,
|
||||
screen_size_x(s)), data->cy, 0);
|
||||
screen_write_stop(&ctx);
|
||||
wp->flags |= PANE_REDRAWSCROLLBAR;
|
||||
window_pane_scrollbar_redraw(wp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user