cgram(6): Don't move over the last char and fix an assertion
authorAaron LI <aly@aaronly.me>
Mon, 22 Feb 2021 14:22:53 +0000 (22:22 +0800)
committerAaron LI <aly@aaronly.me>
Mon, 22 Feb 2021 14:33:30 +0000 (22:33 +0800)
commit18d09f18cf4c93d9a07b8129fed0bdc0d0b967a7
tree2aadf2e3af1e620d322843586cefd66c1581147b
parent564d76995a9b0d872beace4bedee44a79e102dce
cgram(6): Don't move over the last char and fix an assertion

The maximum value of cursor_x was the text length and thus also
*equaled* to extent_x, which broke the assertion in substitute()
and caused crashes.

In addition, the cursor could move just beyond the last character
on a line, which didn't make much sense.

So only allow the cursor move to the last char but not over it.
This also properly fix the above assertion issue.
games/cgram/cgram.c