Remove a few buggy CodeMirror parameters In particular, line numbers seem to be inexplicably broken in CodeMirror when enabled in this plugin. Also sets the height of the .CodeMirror to 'auto'. Bug: Issue 8114 Change-Id: Ib7cd1f5d74418d6fa0e2a6b16b06ccd77090e06c
diff --git a/gr-editor/gr-editor.html b/gr-editor/gr-editor.html index 9ff47d1..e1b0ba2 100644 --- a/gr-editor/gr-editor.html +++ b/gr-editor/gr-editor.html
@@ -19,13 +19,15 @@ <dom-module id="gr-editor"> <template> <style include="gr-editor-styles"> - .CodeMirror, #wrapper { height: 100%; z-index: 0; } .CodeMirror { font-family: 'Roboto Mono', Menlo, 'Lucida Console', Monaco, monospace; + height: auto; + /* CodeMirror has a default z-index of 4. Set to 0 to avoid collisions with fixed header. */ + z-index: 0; } </style> <div id="wrapper"></div>
diff --git a/gr-editor/gr-editor.js b/gr-editor/gr-editor.js index d75f7bd..4621fe7 100644 --- a/gr-editor/gr-editor.js +++ b/gr-editor/gr-editor.js
@@ -52,7 +52,7 @@ }, getCodeMirrorParams(type, value, prefs) { - const params = {value}; + const params = {value, viewportMargin: Infinity}; if (prefs) { // TODO: Add gerrit's customizations from java codemirror to javascript @@ -66,7 +66,8 @@ // TODO(kaspern): Add support for keymaps. // params.keyMap = prefs.key_map_type.toLowerCase(); params.lineLength = prefs.line_length; - params.lineNumbers = prefs.hide_line_numbers; + // Line numbers are currently broken. See Issue 8114. + params.lineNumbers = false; params.lineWrapping = prefs.line_wrapping; params.indentWithTabs = prefs.indent_with_tabs; params.matchBrackets = prefs.match_brackets; @@ -74,10 +75,8 @@ // Support for this is somewhere in gerrit's codebase // needs backporting to javascript params.mode = prefs.syntax_highlighting ? this._mapFileType(type) : ''; - params.origLeft = value; params.showTabs = prefs.show_tabs; params.showTrailingSpace = prefs.show_whitespace_errors; - params.styleSelectedText = true; params.tabSize = prefs.tab_size; // TODO(kaspern): Add support for themes. // params.theme = prefs.theme.toLowerCase();