Fixed wrong history prefixes.

If the ':' was typed into input box and the history search started and a
history item with :open ... was put into input box, the next history step used
the ':open ' as a new prefix for commands to fill. Now the input is only
processed at the start of the history searching, so that later changes won't
corrupt the printed items.
Also fixed missed first item in stepping forward through the history.
Al least the global variables out of the vb struct where removed to start to
decentralize the data stores and to them from the rest of the application.