Преглед на файлове

Merge pull request #1110 from blink1073/bump-xterm

Bump xterm version
Afshin Darian преди 8 години
родител
ревизия
9a229258e4
променени са 4 файла, в които са добавени 31 реда и са изтрити 21 реда
  1. 3 0
      jupyterlab/webpack.config.js
  2. 1 1
      package.json
  3. 6 8
      src/terminal/index.ts
  4. 21 12
      typings/xterm/xterm.d.ts

+ 3 - 0
jupyterlab/webpack.config.js

@@ -29,6 +29,9 @@ buildExtension({
   config: {
     output: {
       publicPath: 'lab/'
+    },
+    module: {
+      noParse: [/xterm/]  // Xterm ships a UMD module
     }
   }
 });

+ 1 - 1
package.json

@@ -22,7 +22,7 @@
     "sanitize-html": "^1.12.0",
     "semver": "^5.3.0",
     "simulate-event": "^1.2.0",
-    "xterm": "^1.1.3"
+    "xterm": "^2.0.1"
   },
   "devDependencies": {
     "@types/d3-dsv": "^1.0.29",

+ 6 - 8
src/terminal/index.ts

@@ -20,7 +20,6 @@ import {
 import * as Xterm
   from 'xterm';
 
-
 /**
  * The class name added to a terminal widget.
  */
@@ -69,7 +68,6 @@ class TerminalWidget extends Widget {
     this.color = options.color || 'white';
     this.id = `jp-TerminalWidget-${Private.id++}`;
     this.title.label = 'Terminal';
-    (Xterm as any).brokenBold = true;
   }
 
   /**
@@ -138,42 +136,42 @@ class TerminalWidget extends Widget {
    * Get whether the bell is shown.
    */
   get visualBell(): boolean {
-    return this._term.visualBell;
+    return this._term.getOption('visualBell');
   }
 
   /**
    * Set whether the bell is shown.
    */
   set visualBell(value: boolean) {
-    this._term.visualBell = value;
+    this._term.setOption('visualBell', value);
   }
 
   /**
    * Get whether to focus on a bell event.
    */
   get popOnBell(): boolean {
-    return this._term.popOnBell;
+    return this._term.getOption('popOnBell');
   }
 
   /**
    * Set whether to focus on a bell event.
    */
   set popOnBell(value: boolean) {
-    this._term.popOnBell = value;
+    this._term.setOption('popOnBell', value);
   }
 
   /**
    * Get the size of the scrollback buffer in the terminal.
    */
   get scrollback(): number {
-    return this._term.scrollback;
+    return this._term.getOption('scrollback');
   }
 
   /**
    * Set the size of the scrollback buffer in the terminal.
    */
   set scrollback(value: number) {
-    this._term.scrollback = value;
+    this._term.setOption('scrollback', value);
   }
 
   /**

+ 21 - 12
typings/xterm/xterm.d.ts

@@ -12,36 +12,45 @@ interface Xterm {
 
   element: HTMLElement;
 
-  colors: string[];
+  textarea: HTMLElement;
 
-  rows: number;
+  attachCustomKeydownHandler(callback: (event: KeyboardEvent) => boolean): void;
 
-  cols: number;
+  blur(): void;
 
-  visualBell: boolean;
+  clear(): void;
 
-  popOnBell: boolean;
+  destroy(): void;
+
+  focus(): void;
 
-  scrollback: number;
+  getOption(key: string): any;
 
   on(event: string, callback: (arg: any) => void): void;
 
-  open(el: HTMLElement): void;
+  off(event: string, callback: (arg: any) => void): void;
 
-  write(msg: string): void;
+  open(parent: HTMLElement): void;
 
-  resize(width: number, height: number): void;
+  refresh(start: number, end: number, queue?: boolean): void;
 
-  destroy(): void;
+  reset(): void;
 
-  focus(): void;
+  resize(x: number, y: number): void;
+
+  scrollDisp(n: number): void;
+
+  setOption(key: string, value: any): void;
+
+  write(text: string): void;
+
+  writeln(text: string): void;
 }
 
 
 interface XtermConstructor {
   new (options?: Xterm.IOptions): Xterm;
   (options?: Xterm.IOptions): Xterm;
-  brokenBold: boolean;
 }