Skip to content

Commit

Permalink
Refit to the browser window after changing font size (#416)
Browse files Browse the repository at this point in the history
Fixes #415

Signed-off-by: Ondřej Caletka <ondrej@caletka.cz>
  • Loading branch information
oskar456 committed Jul 23, 2020
1 parent 56a135d commit cb3e720
Show file tree
Hide file tree
Showing 2 changed files with 8,729 additions and 8,719 deletions.
8 changes: 7 additions & 1 deletion html/src/components/terminal/index.tsx
Expand Up @@ -233,7 +233,7 @@ export class Xterm extends Component<Props> {

@bind
private onSocketData(event: MessageEvent) {
const { terminal, textDecoder, zmodemAddon } = this;
const { terminal, textDecoder, zmodemAddon, fitAddon } = this;
const rawData = event.data as ArrayBuffer;
const cmd = String.fromCharCode(new Uint8Array(rawData)[0]);
const data = rawData.slice(1);
Expand Down Expand Up @@ -262,6 +262,12 @@ export class Xterm extends Component<Props> {
console.log('[ttyd] Leave site alert disabled');
}
break;
case 'fontSize':
console.log(`[ttyd] setting font size to ${preferences[key]}`);
terminal.setOption(key, preferences[key]);
fitAddon.fit();
break;

default:
console.log(`[ttyd] option: ${key}=${preferences[key]}`);
terminal.setOption(key, preferences[key]);
Expand Down

0 comments on commit cb3e720

Please sign in to comment.