Fill in screen state code. It's not quite working yet. We don't handle newlines, and that causes the row/col computations to go out of sync.