Included "mainloop" code for coordination of screen and buffer during editing