patch 8.2.0316: ex_getln.c code has insufficient test coverage
Problem: ex_getln.c code has insufficient test coverage.
Solution: Add more tests. Fix a problem. (Yegappan Lakshmanan, closes #5693)
diff --git a/src/cmdhist.c b/src/cmdhist.c
index 683fc86..d708535 100644
--- a/src/cmdhist.c
+++ b/src/cmdhist.c
@@ -389,7 +389,7 @@
i += hislen;
wrapped = TRUE;
}
- if (hist[i].hisnum == num && hist[i].hisstr != NULL)
+ if (i >= 0 && hist[i].hisnum == num && hist[i].hisstr != NULL)
return i;
}
else if (-num <= hislen)