refactor out Docview:render calling into a seperate function

so that it won't be called when redering is not neccessary.