Don't use getline to read lines from scripts.
Fixed old segfault.

SDL sends keyup events on keys twice if you LALT move the
window, and sometimes when focus happens. It now survives this.