From 8f9491ddfe525f8ac32175871d269d0fb4adebc3 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 3 Sep 2018 08:51:43 +0000 Subject: [PATCH] Allow a large line number to go to the end with goto-line, from Mark Kelly in GitHub issue 1460. --- window-copy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/window-copy.c b/window-copy.c index 39bf2c2e..660eb63c 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1273,11 +1273,13 @@ window_copy_goto_line(struct window_pane *wp, const char *linestr) { struct window_copy_mode_data *data = wp->modedata; const char *errstr; - u_int lineno; + int lineno; - lineno = strtonum(linestr, 0, screen_hsize(data->backing), &errstr); + lineno = strtonum(linestr, -1, INT_MAX, &errstr); if (errstr != NULL) return; + if (lineno < 0 || (u_int)lineno > screen_hsize(data->backing)) + lineno = screen_hsize(data->backing); data->oy = lineno; window_copy_update_selection(wp, 1);