src/editor/InlineTextEditor.js
function _syncGutterWidths(hostEditor) {
        var allHostedEditors = EditorManager.getInlineEditors(hostEditor);

        // add the host itself to the list too
        allHostedEditors.push(hostEditor);

        var maxWidth = 0;
        allHostedEditors.forEach(function (editor) {
            var $gutter = $(editor._codeMirror.getGutterElement()).find(".CodeMirror-linenumbers");
            $gutter.css("min-width", "");
            var curWidth = $gutter.width();
            if (curWidth > maxWidth) {
                maxWidth = curWidth;
            }
        });

        if (allHostedEditors.length === 1) {
            //There's only the host, just refresh the gutter
            allHostedEditors[0]._codeMirror.setOption("gutters", allHostedEditors[0]._codeMirror.getOption("gutters"));
            return;
        }

        maxWidth = maxWidth + "px";
        allHostedEditors.forEach(function (editor) {
            $(editor._codeMirror.getGutterElement()).find(".CodeMirror-linenumbers").css("min-width", maxWidth);

            // Force CodeMirror to refresh the gutter
            editor._codeMirror.setOption("gutters", editor._codeMirror.getOption("gutters"));
        });
    }
function _syncGutterWidths(hostEditor) {
        var allHostedEditors = EditorManager.getInlineEditors(hostEditor);

        // add the host itself to the list too
        allHostedEditors.push(hostEditor);

        var maxWidth = 0;
        allHostedEditors.forEach(function (editor) {
            var $gutter = $(editor._codeMirror.getGutterElement()).find(".CodeMirror-linenumbers");
            $gutter.css("min-width", "");
            var curWidth = $gutter.width();
            if (curWidth > maxWidth) {
                maxWidth = curWidth;
            }
        });

        if (allHostedEditors.length === 1) {
            //There's only the host, just refresh the gutter
            allHostedEditors[0]._codeMirror.setOption("gutters", allHostedEditors[0]._codeMirror.getOption("gutters"));
            return;
        }

        maxWidth = maxWidth + "px";
        allHostedEditors.forEach(function (editor) {
            $(editor._codeMirror.getGutterElement()).find(".CodeMirror-linenumbers").css("min-width", maxWidth);

            // Force CodeMirror to refresh the gutter
            editor._codeMirror.setOption("gutters", editor._codeMirror.getOption("gutters"));
        });
    }
function _syncGutterWidths ( hostEditor ) { var allHostedEditors = EditorManager . getInlineEditors ( hostEditor ) ; // add the host itself to the list too allHostedEditors . push ( hostEditor ) ; var maxWidth = 0 ; allHostedEditors . forEach ( function ( editor ) { var $gutter = $ ( editor . _codeMirror . getGutterElement ( ) ) . find ( ".CodeMirror-linenumbers" ) ; $gutter . css ( "min-width" , "" ) ; var curWidth = $gutter . width ( ) ; if ( curWidth > maxWidth ) { maxWidth = curWidth ; } } ) ; if ( allHostedEditors . length === 1 ) { //There's only the host, just refresh the gutter allHostedEditors [ 0 ] . _codeMirror . setOption ( "gutters" , allHostedEditors [ 0 ] . _codeMirror . getOption ( "gutters" ) ) ; return ; } maxWidth = maxWidth + "px" ; allHostedEditors . forEach ( function ( editor ) { $ ( editor . _codeMirror . getGutterElement ( ) ) . find ( ".CodeMirror-linenumbers" ) . css ( "min-width" , maxWidth ) ; // Force CodeMirror to refresh the gutter editor . _codeMirror . setOption ( "gutters" , editor . _codeMirror . getOption ( "gutters" ) ) ; } ) ; }
Given a host editor and its inline editors, find the widest gutter and make all the others match
@param {!Editor} hostEditor Host editor containing all the inline editors to sync
@private
Given a host editor and its inline editors find the widest gutter and make all the others match