get_url_param = function (name) {
        // get a URL parameter. I cannot believe we actually need this.
        // Based on http://stackoverflow.com/a/25359264/938949
        var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
        if (match) {
            return decodeURIComponent(match[1] || '');
        }
    }
turn absolute cursor postion into CodeMirror col, ch cursor