MyBB Community Forums

Full Version: CodeMirror
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi.
CodeMirror have a bug when line is large.
[attachment=32031][attachment=32032]
Text area increase a size into right over my browser window.
But why ? Text area have a bottom slider to move into left and right.
can you check it with another browser (eg. firefox) & post back whether the issue persists ..
I fixed this error by adding the maximum width of the window textarea in file:
admin/jscripts/codemirror/lib/codemirror.js
function adjustContentWidth(cm) {
    var display = cm.display;
    var width = measureChar(cm, display.maxLine, display.maxLine.text.length).left;
    display.maxLineChanged = false;
    var minWidth = Math.max(0, width + 3);
    var maxScrollLeft = Math.max(0, display.sizer.offsetLeft + minWidth + scrollerCutOff - display.scroller.clientWidth);
    display.sizer.style.minWidth = minWidth + "px";
    display.sizer.style.maxWidth = "1024px";
    if (maxScrollLeft < cm.doc.scrollLeft)
      setScrollLeft(cm, Math.min(display.scroller.scrollLeft, maxScrollLeft), true);
  }
Yes, this fix is working but you use hardcoded maxwidth value, is it ok?
I don't feel good in Java Script, but this large value work fine for me, don't know why textarea is calculate to max line width.
If you think this is hardcoded value, you can set it to max-width: 0px; and it's work too fine.
We can waiting long time for fix it. I prefered faster way.
Wait for someone from mybb team who knows more about java script...
There's a reason why this is marked as "Duplicate" - we've fixed this already