summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/screen.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-04-22 08:48:45 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-04-22 08:48:45 +0000
commit3b0641bfbabde169b35decfc663456c2669c4ca1 (patch)
tree5967e9962a25e4ed573f4b3161c12f9bdf0816ae /usr.bin/tmux/screen.c
parent0bc61cd39b69ff48f8f66c0a1db9645b2a52abbf (diff)
Update the cursor position when deleting lines from screens without
history, GitHub issue 2173.
Diffstat (limited to 'usr.bin/tmux/screen.c')
-rw-r--r--usr.bin/tmux/screen.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c
index 7776f24b9ef..c8404e917f8 100644
--- a/usr.bin/tmux/screen.c
+++ b/usr.bin/tmux/screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen.c,v 1.65 2020/04/18 17:20:25 nicm Exp $ */
+/* $OpenBSD: screen.c,v 1.66 2020/04/22 08:48:44 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -48,7 +48,7 @@ struct screen_title_entry {
};
TAILQ_HEAD(screen_titles, screen_title_entry);
-static void screen_resize_y(struct screen *, u_int, int);
+static void screen_resize_y(struct screen *, u_int, int, u_int *);
static void screen_reflow(struct screen *, u_int, u_int *, u_int *);
/* Free titles stack. */
@@ -254,7 +254,7 @@ screen_resize_cursor(struct screen *s, u_int sx, u_int sy, int reflow,
reflow = 0;
if (sy != screen_size_y(s))
- screen_resize_y(s, sy, eat_empty);
+ screen_resize_y(s, sy, eat_empty, cy);
if (reflow)
screen_reflow(s, sx, cx, cy);
@@ -281,7 +281,7 @@ screen_resize(struct screen *s, u_int sx, u_int sy, int reflow)
}
static void
-screen_resize_y(struct screen *s, u_int sy, int eat_empty)
+screen_resize_y(struct screen *s, u_int sy, int eat_empty, u_int *cy)
{
struct grid *gd = s->grid;
u_int needed, available, oldy, i;
@@ -330,6 +330,7 @@ screen_resize_y(struct screen *s, u_int sy, int eat_empty)
if (available > needed)
available = needed;
grid_view_delete_lines(gd, 0, available, 8);
+ (*cy) -= available;
}
}