Is this what we're trying to achieve? http://codemirror.net/demo/resize.html