Fix multiline edits

It appears that edit.py has problems when you queue up a ton of
inserts and erases. Work around this by using one edit per line,
and gluing liberally.
Fix history checking for glued commands