1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Fix off-by-one in script editor letting you type on a nonexistent line

For a long time, the script editor has had a bug where it would let you
put the cursor on a nonexistent script line, which would APPEAR to be
the last line of the script... but in reality, it WASN'T the last line
of the script, and in fact, the ACTUAL last line was the line ABOVE the
script.

So, if you typed anything on this nonexistent line, it would appear to
get erased when exiting the script. Thus, people have (erroneously)
misdiagnosed this as the script editor somehow being trigger-happy and
erasing lines when it shouldn't be, when in reality it should've have
let you gone onto that line in the first place!
This commit is contained in:
Info Teddy 2020-01-18 17:38:36 -08:00 committed by Ethan Lee
parent 134a0f1070
commit b1d6b7f395

View file

@ -3834,7 +3834,7 @@ void editorinput( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map, enti
if(key.keymap[SDLK_DOWN] && ed.keydelay<=0) if(key.keymap[SDLK_DOWN] && ed.keydelay<=0)
{ {
ed.keydelay=6; ed.keydelay=6;
if(ed.sby+ed.pagey<ed.sblength) if(ed.sby+ed.pagey<ed.sblength-1)
{ {
ed.sby++; ed.sby++;
if(ed.sby>=20) if(ed.sby>=20)