Pārlūkot izejas kodu

Merge pull request #6032 from telamonian/fix-codemirror-styling

Fix codemirror styling
Brian E. Granger 6 gadi atpakaļ
vecāks
revīzija
b212097539
2 mainītis faili ar 15 papildinājumiem un 2 dzēšanām
  1. 8 0
      packages/cells/src/widget.ts
  2. 7 2
      packages/codemirror/style/index.css

+ 8 - 0
packages/cells/src/widget.ts

@@ -364,6 +364,14 @@ export class Cell extends Widget {
     this.editor.focus();
   }
 
+  /**
+   * Handle `fit-request` messages.
+   */
+  protected onFitRequest(msg: Message): void {
+    // need this for for when a theme changes font size
+    this.editor.refresh();
+  }
+
   /**
    * Handle `update-request` messages.
    */

+ 7 - 2
packages/codemirror/style/index.css

@@ -43,7 +43,12 @@
 /* This causes https://github.com/jupyter/jupyterlab/issues/522 */
 /* May not cause it not because we changed it! */
 .CodeMirror-lines {
-  padding: var(--jp-code-padding);
+  padding: var(--jp-code-padding) 0;
+}
+
+/* Set horizontal padding on line nodes for correct margins */
+pre.CodeMirror-line {
+  padding: 0 var(--jp-code-padding);
 }
 
 .CodeMirror-linenumbers {
@@ -153,7 +158,7 @@
 }
 
 .cm-s-jupyter .CodeMirror-cursor {
-  border-left: 1.4px solid var(--jp-editor-cursor-color);
+  border-left: var(--jp-code-cursor-width0) solid var(--jp-editor-cursor-color);
 }
 .cm-s-jupyter span.cm-keyword {
   color: var(--jp-mirror-editor-keyword-color);