diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-07-14 15:47:58 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-07-14 15:47:58 +0200 |
commit | e77f4d3224ddfc0130dd390e565efe4b56ecec1d (patch) | |
tree | 6806124c93e6a36717f0d630d7f1d24083efd3a3 /src/parser.cpp | |
parent | 7a851424152a942443190ac34856c08d8dfe7580 (diff) | |
download | sciteco-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.cpp | 6 |
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; |