mirror of
https://github.com/tmux/tmux.git
synced 2026-03-31 16:56:28 +00:00
When history-limit is changed, apply to existing panes, not just new
ones. GitHub issue 4705.
This commit is contained in:
@@ -82,7 +82,7 @@ grid_view_clear_history(struct grid *gd, u_int bg)
|
|||||||
|
|
||||||
/* Scroll the lines into the history. */
|
/* Scroll the lines into the history. */
|
||||||
for (yy = 0; yy < last; yy++) {
|
for (yy = 0; yy < last; yy++) {
|
||||||
grid_collect_history(gd);
|
grid_collect_history(gd, 0);
|
||||||
grid_scroll_history(gd, bg);
|
grid_scroll_history(gd, bg);
|
||||||
}
|
}
|
||||||
if (last < gd->sy)
|
if (last < gd->sy)
|
||||||
@@ -107,7 +107,7 @@ grid_view_scroll_region_up(struct grid *gd, u_int rupper, u_int rlower,
|
|||||||
u_int bg)
|
u_int bg)
|
||||||
{
|
{
|
||||||
if (gd->flags & GRID_HISTORY) {
|
if (gd->flags & GRID_HISTORY) {
|
||||||
grid_collect_history(gd);
|
grid_collect_history(gd, 0);
|
||||||
if (rupper == 0 && rlower == gd->sy - 1)
|
if (rupper == 0 && rlower == gd->sy - 1)
|
||||||
grid_scroll_history(gd, bg);
|
grid_scroll_history(gd, bg);
|
||||||
else {
|
else {
|
||||||
|
|||||||
5
grid.c
5
grid.c
@@ -375,13 +375,16 @@ grid_trim_history(struct grid *gd, u_int ny)
|
|||||||
* and shift up.
|
* and shift up.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
grid_collect_history(struct grid *gd)
|
grid_collect_history(struct grid *gd, int all)
|
||||||
{
|
{
|
||||||
u_int ny;
|
u_int ny;
|
||||||
|
|
||||||
if (gd->hsize == 0 || gd->hsize < gd->hlimit)
|
if (gd->hsize == 0 || gd->hsize < gd->hlimit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (all)
|
||||||
|
ny = gd->hsize - gd->hlimit;
|
||||||
|
else
|
||||||
ny = gd->hlimit / 10;
|
ny = gd->hlimit / 10;
|
||||||
if (ny < 1)
|
if (ny < 1)
|
||||||
ny = 1;
|
ny = 1;
|
||||||
|
|||||||
@@ -1252,6 +1252,10 @@ options_push_changes(const char *name)
|
|||||||
utf8_update_width_cache();
|
utf8_update_width_cache();
|
||||||
if (strcmp(name, "input-buffer-size") == 0)
|
if (strcmp(name, "input-buffer-size") == 0)
|
||||||
input_set_buffer_size(options_get_number(global_options, name));
|
input_set_buffer_size(options_get_number(global_options, name));
|
||||||
|
if (strcmp(name, "history-limit") == 0) {
|
||||||
|
RB_FOREACH(s, sessions, &sessions)
|
||||||
|
session_update_history(s);
|
||||||
|
}
|
||||||
RB_FOREACH(s, sessions, &sessions)
|
RB_FOREACH(s, sessions, &sessions)
|
||||||
status_update_cache(s);
|
status_update_cache(s);
|
||||||
|
|
||||||
|
|||||||
26
session.c
26
session.c
@@ -768,3 +768,29 @@ session_theme_changed(struct session *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update history for all panes. */
|
||||||
|
void
|
||||||
|
session_update_history(struct session *s)
|
||||||
|
{
|
||||||
|
struct winlink *wl;
|
||||||
|
struct window_pane *wp;
|
||||||
|
struct grid *gd;
|
||||||
|
u_int limit, osize;
|
||||||
|
|
||||||
|
limit = options_get_number(s->options, "history-limit");
|
||||||
|
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||||
|
TAILQ_FOREACH(wp, &wl->window->panes, entry) {
|
||||||
|
gd = wp->base.grid;
|
||||||
|
|
||||||
|
osize = gd->hsize;
|
||||||
|
gd->hlimit = limit;
|
||||||
|
grid_collect_history(gd, 1);
|
||||||
|
|
||||||
|
if (gd->hsize != osize) {
|
||||||
|
log_debug("%s: %%%u %u -> %u", __func__, wp->id,
|
||||||
|
osize, gd->hsize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
4
tmux.1
4
tmux.1
@@ -4583,9 +4583,7 @@ If set to 0, messages and indicators are displayed until a key is pressed.
|
|||||||
.Ar time
|
.Ar time
|
||||||
is in milliseconds.
|
is in milliseconds.
|
||||||
.It Ic history-limit Ar lines
|
.It Ic history-limit Ar lines
|
||||||
Set the maximum number of lines held in window history.
|
Set the maximum number of lines held in pane history.
|
||||||
This setting applies only to new windows - existing window histories are not
|
|
||||||
resized and retain the limit at the point they were created.
|
|
||||||
.It Ic initial-repeat-time Ar time
|
.It Ic initial-repeat-time Ar time
|
||||||
Set the time in milliseconds for the initial repeat when a key is bound with the
|
Set the time in milliseconds for the initial repeat when a key is bound with the
|
||||||
.Fl r
|
.Fl r
|
||||||
|
|||||||
3
tmux.h
3
tmux.h
@@ -3002,7 +3002,7 @@ int grid_cells_look_equal(const struct grid_cell *,
|
|||||||
struct grid *grid_create(u_int, u_int, u_int);
|
struct grid *grid_create(u_int, u_int, u_int);
|
||||||
void grid_destroy(struct grid *);
|
void grid_destroy(struct grid *);
|
||||||
int grid_compare(struct grid *, struct grid *);
|
int grid_compare(struct grid *, struct grid *);
|
||||||
void grid_collect_history(struct grid *);
|
void grid_collect_history(struct grid *, int);
|
||||||
void grid_remove_history(struct grid *, u_int );
|
void grid_remove_history(struct grid *, u_int );
|
||||||
void grid_scroll_history(struct grid *, u_int);
|
void grid_scroll_history(struct grid *, u_int);
|
||||||
void grid_scroll_history_region(struct grid *, u_int, u_int, u_int);
|
void grid_scroll_history_region(struct grid *, u_int, u_int, u_int);
|
||||||
@@ -3485,6 +3485,7 @@ u_int session_group_count(struct session_group *);
|
|||||||
u_int session_group_attached_count(struct session_group *);
|
u_int session_group_attached_count(struct session_group *);
|
||||||
void session_renumber_windows(struct session *);
|
void session_renumber_windows(struct session *);
|
||||||
void session_theme_changed(struct session *);
|
void session_theme_changed(struct session *);
|
||||||
|
void session_update_history(struct session *);
|
||||||
|
|
||||||
/* utf8.c */
|
/* utf8.c */
|
||||||
enum utf8_state utf8_towc (const struct utf8_data *, wchar_t *);
|
enum utf8_state utf8_towc (const struct utf8_data *, wchar_t *);
|
||||||
|
|||||||
@@ -2708,6 +2708,11 @@ window_copy_cmd_refresh_from_pane(struct window_copy_cmd_state *cs)
|
|||||||
data->backing = window_copy_clone_screen(&wp->base, &data->screen, NULL,
|
data->backing = window_copy_clone_screen(&wp->base, &data->screen, NULL,
|
||||||
NULL, wme->swp != wme->wp);
|
NULL, wme->swp != wme->wp);
|
||||||
|
|
||||||
|
if (data->oy > screen_hsize(data->backing)) {
|
||||||
|
data->cy = 0;
|
||||||
|
data->oy = screen_hsize(data->backing);
|
||||||
|
}
|
||||||
|
|
||||||
window_copy_size_changed(wme);
|
window_copy_size_changed(wme);
|
||||||
return (WINDOW_COPY_CMD_REDRAW);
|
return (WINDOW_COPY_CMD_REDRAW);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user