Refactor preview into a member function and render preview correctly

Preview wasn't rendered if nothing was selected and also when selecting
new entries. Something had to be selected first.