Commit b2c2db07 by Iwasaki Yudai

Move responsibility to decode output encoding to terminal implementation

1 parent 807bcc25
This diff could not be displayed because it is too large.
import * as bare from "xterm";
import { lib } from "libapps";
export declare class Xterm {
elem: HTMLElement;
term: bare;
resizeListener: () => void;
decoder: lib.UTF8Decoder;
message: HTMLElement;
messageTimeout: number;
messageTimer: number;
term: bare;
resizeListener: () => void;
constructor(elem: HTMLElement);
info(): {
columns: number;
......
......@@ -29,7 +29,7 @@ export class Hterm {
output(data: string) {
if (this.term.io != null) {
this.term.io.writeUTF16(data);
this.term.io.writeUTF8(data);
}
};
......
import { lib } from "libapps"
export const protocols = ["webtty"];
export const msgInputUnknown = '0';
......@@ -65,8 +63,6 @@ export class WebTTY {
let reconnectTimeout: number;
const setup = () => {
const decoder = new lib.UTF8Decoder()
connection.onOpen(() => {
const termInfo = this.term.info();
......@@ -108,7 +104,7 @@ export class WebTTY {
const payload = data.slice(1);
switch (data[0]) {
case msgOutput:
this.term.output(decoder.decode(atob(payload)));
this.term.output(atob(payload));
break;
case msgPong:
break;
......
import * as bare from "xterm";
import { lib } from "libapps"
bare.loadAddon("fit");
export class Xterm {
elem: HTMLElement;
term: bare;
resizeListener: () => void;
decoder: lib.UTF8Decoder;
message: HTMLElement;
messageTimeout: number;
messageTimer: number;
term: bare;
resizeListener: () => void;
constructor(elem: HTMLElement) {
this.elem = elem;
......@@ -20,7 +23,6 @@ export class Xterm {
this.message.className = "xterm-overlay";
this.messageTimeout = 2000;
this.resizeListener = () => {
this.term.fit();
this.term.scrollToBottom();
......@@ -33,6 +35,8 @@ export class Xterm {
});
this.term.open(elem, true);
this.decoder = new lib.UTF8Decoder()
};
info(): { columns: number, rows: number } {
......@@ -40,7 +44,7 @@ export class Xterm {
};
output(data: string) {
this.term.write(data);
this.term.write(this.decoder.decode(data));
};
showMessage(message: string, timeout: number) {
......
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!