diff options
author | nicm <nicm> | 2020-04-14 18:33:01 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-04-14 18:33:01 +0000 |
commit | e11295f42d55a387d1609dde7ff7e2c7745c2be2 (patch) | |
tree | 53728223e91fa0ed4d7283293e8a831980083858 | |
parent | 1ef9a69f4fcb503bc2cf1a5901a9ca6eaaae5d44 (diff) | |
download | rtmux-e11295f42d55a387d1609dde7ff7e2c7745c2be2.tar.gz rtmux-e11295f42d55a387d1609dde7ff7e2c7745c2be2.tar.bz2 rtmux-e11295f42d55a387d1609dde7ff7e2c7745c2be2.zip |
Adjust cursor and scroll positions when entering copy mode so that the
cursor line is still visible even if the source and target panes are
different heights.
-rw-r--r-- | window-copy.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/window-copy.c b/window-copy.c index efb4a43f..90c4b45f 100644 --- a/window-copy.c +++ b/window-copy.c @@ -376,10 +376,18 @@ window_copy_init(struct window_mode_entry *wme, u_int i; data = window_copy_common_init(wme); - data->backing = window_copy_clone_screen(&wp->base, &data->screen); - data->cx = data->backing->cx; - data->cy = data->backing->cy; + + data->cx = wp->base.cx; + if (data->cx > screen_size_x(&data->screen) - 1) + data->cx = screen_size_x(&data->screen) - 1; + + data->cy = screen_hsize(&wp->base) + wp->base.cy; + if (data->cy < screen_hsize(data->backing)) { + data->oy = screen_hsize(data->backing) - data->cy; + data->cy = 0; + } else + data->cy -= screen_hsize(data->backing); data->scroll_exit = args_has(args, 'e'); data->hide_position = args_has(args, 'H'); |