Writing a text editor in prolog

A post was split to a new topic: Dealing with state