aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-07-14 15:47:58 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-07-14 15:47:58 +0200
commite77f4d3224ddfc0130dd390e565efe4b56ecec1d (patch)
tree6806124c93e6a36717f0d630d7f1d24083efd3a3 /src/parser.cpp
parent7a851424152a942443190ac34856c08d8dfe7580 (diff)
downloadsciteco-e77f4d3224ddfc0130dd390e565efe4b56ecec1d.tar.gz
fixed <nA> for n pointing to the buffer end
* throws an error now instead of returning 0 * for <A> positions referring to the buffer end are invalid (unlike many other commands). * has been broken for a very long time (possibly always?)
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp6
1 files changed, 5 insertions, 1 deletions
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 <A>.
+ */
+ if (v < 0 || v >= interface.ssm(SCI_GETLENGTH))
throw RangeError("A");
expressions.push(interface.ssm(SCI_GETCHARAT, v));
break;