From 48bd94e98fdc2b119185a9928b128faa019c52e5 Mon Sep 17 00:00:00 2001 From: Yamakaky Date: Tue, 5 May 2015 19:39:03 +0200 Subject: [PATCH] vim-patch:7.4.606 #2594 Problem: May crash when using a small window. Solution: Avoid dividing by zero. (Christian Brabandt) https://github.com/vim/vim/commit/v7-4-606 --- src/nvim/normal.c | 4 ++++ src/nvim/version.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 676afe9e91..3cf3636e23 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3399,6 +3399,10 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist) width1 = curwin->w_width - col_off1; width2 = curwin->w_width - col_off2; + if (width2 == 0) { + width2 = 1; // Avoid divide by zero. + } + if (curwin->w_width != 0) { /* * Instead of sticking at the last character of the buffer line we diff --git a/src/nvim/version.c b/src/nvim/version.c index 841d8b4fe1..ce7a21a99a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -177,7 +177,7 @@ static int included_patches[] = { //609, //608, //607, - //606, + 606, //605, //604, //603,