screen: move the margin determination to the main loop

There is no need to look at this for every painted line, because
the margin can only change when some key is struck.
2 files changed