stylish-userstyles / stylish-chrome

Stylish extension for Chrome and Chrome-like things
GNU General Public License v3.0
184 stars 53 forks source link

Resize code editor to fit #1

Open JasonBarnabe opened 11 years ago

JasonBarnabe commented 11 years ago

Copied from https://github.com/JasonBarnabe/stylish/issues/93

http://forum.userstyles.org/discussion/34496/stylish-chrome-1.1-update-suggestion#Item_11

http://codemirror.net/demo/resize.html

This looks like it would do it, but setting viewportMargin = Infinity makes things noticeably slow even for stylsheets a few hundred lines long.

tophf commented 9 years ago

What about adding a simple resize gripper in the right bottom corner like this at least? Implemented in a4f602c7aa4e60dcbaab3e110035662c94788c09

tophf commented 9 years ago

Tried implementing autoresize:

function setupCodeMirror(textarea) {
.................................
    cm.display.wrapper.style.height = cm.display.sizer.scrollHeight + 'px';
    cm.on("changes", function(cm) {
        if (cm.display.wrapper.scrollHeight !== cm.display.sizer.scrollHeight) {
            cm.display.wrapper.style.height = cm.display.sizer.scrollHeight + 'px';
        }
    });

But in very tall sections the cursor sometimes wasn't scrolled into view, probably a Chrome's or CodeMirror's issue, needs more investigation.