OLD | NEW |
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others | 1 // CodeMirror, copyright (c) by Marijn Haverbeke and others |
2 // Distributed under an MIT license: http://codemirror.net/LICENSE | 2 // Distributed under an MIT license: http://codemirror.net/LICENSE |
3 | 3 |
4 // This is CodeMirror (http://codemirror.net), a code editor | 4 // This is CodeMirror (http://codemirror.net), a code editor |
5 // implemented in JavaScript on top of the browser's DOM. | 5 // implemented in JavaScript on top of the browser's DOM. |
6 // | 6 // |
7 // You can find some technical background for some of the code below | 7 // You can find some technical background for some of the code below |
8 // at http://marijnhaverbeke.nl/blog/#cm-internals . | 8 // at http://marijnhaverbeke.nl/blog/#cm-internals . |
9 | 9 |
10 (function(mod) { | 10 (function(mod) { |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 // LINE NUMBERS | 585 // LINE NUMBERS |
586 | 586 |
587 // Re-align line numbers and gutter marks to compensate for | 587 // Re-align line numbers and gutter marks to compensate for |
588 // horizontal scrolling. | 588 // horizontal scrolling. |
589 function alignHorizontally(cm) { | 589 function alignHorizontally(cm) { |
590 var display = cm.display, view = display.view; | 590 var display = cm.display, view = display.view; |
591 if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fix
edGutter)) return; | 591 if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fix
edGutter)) return; |
592 var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.
doc.scrollLeft; | 592 var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.
doc.scrollLeft; |
593 var gutterW = display.gutters.offsetWidth, left = comp + "px"; | 593 var gutterW = display.gutters.offsetWidth, left = comp + "px"; |
594 for (var i = 0; i < view.length; i++) if (!view[i].hidden) { | 594 for (var i = 0; i < view.length; i++) if (!view[i].hidden) { |
595 if (cm.options.fixedGutter && view[i].gutter) | 595 if (cm.options.fixedGutter) { |
596 view[i].gutter.style.left = left; | 596 if (view[i].gutter) |
| 597 view[i].gutter.style.left = left; |
| 598 if (view[i].gutterBackground) |
| 599 view[i].gutterBackground.style.left = left; |
| 600 } |
597 var align = view[i].alignable; | 601 var align = view[i].alignable; |
598 if (align) for (var j = 0; j < align.length; j++) | 602 if (align) for (var j = 0; j < align.length; j++) |
599 align[j].style.left = left; | 603 align[j].style.left = left; |
600 } | 604 } |
601 if (cm.options.fixedGutter) | 605 if (cm.options.fixedGutter) |
602 display.gutters.style.left = (comp + gutterW) + "px"; | 606 display.gutters.style.left = (comp + gutterW) + "px"; |
603 } | 607 } |
604 | 608 |
605 // Used to ensure that the line number gutter is still the right | 609 // Used to ensure that the line number gutter is still the right |
606 // size for the current document size. Returns true when an update | 610 // size for the current document size. Returns true when an update |
(...skipping 8318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8925 | 8929 |
8926 return order; | 8930 return order; |
8927 }; | 8931 }; |
8928 })(); | 8932 })(); |
8929 | 8933 |
8930 // THE END | 8934 // THE END |
8931 | 8935 |
8932 CodeMirror.version = "5.17.1"; | 8936 CodeMirror.version = "5.17.1"; |
8933 | 8937 |
8934 return CodeMirror; | 8938 return CodeMirror; |
8935 }); | 8939 }); |
OLD | NEW |