From e77f4d3224ddfc0130dd390e565efe4b56ecec1d Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 14 Jul 2015 15:47:58 +0200 Subject: fixed for n pointing to the buffer end * throws an error now instead of returning 0 * for positions referring to the buffer end are invalid (unlike many other commands). * has been broken for a very long time (possibly always?) --- src/parser.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/parser.cpp') diff --git a/src/parser.cpp b/src/parser.cpp index 1942281..b6ecc0f 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1455,7 +1455,11 @@ StateStart::custom(gchar chr) BEGIN_EXEC(this); v = interface.ssm(SCI_GETCURRENTPOS) + expressions.pop_num_calc(); - if (!Validate::pos(v)) + /* + * NOTE: We cannot use Validate::pos() here since + * the end of the buffer is not a valid position for . + */ + if (v < 0 || v >= interface.ssm(SCI_GETLENGTH)) throw RangeError("A"); expressions.push(interface.ssm(SCI_GETCHARAT, v)); break; -- cgit v1.2.3