Renderer improvements

@lennartcl 
fixes https://github.com/ajaxorg/ace/issues/1, https://github.com/ajaxorg/ace/issues/1362