oorja 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  // backend api client
2
2
  import https from 'https';
3
3
  import axios, { AxiosError } from 'axios';
4
- import { Encoder, Decoder } from "@msgpack/msgpack";
4
+ import { Encoder, Decoder } from '@msgpack/msgpack';
5
5
  const encoder = new Encoder({ ignoreUndefined: true });
6
6
  const decoder = new Decoder();
7
7
  import { defaultParser } from './resources.js';
@@ -7,4 +7,4 @@ export type dimensions = {
7
7
  };
8
8
  export declare const getDimensions: () => dimensions;
9
9
  export declare const areDimensionEqual: (a: dimensions, b: dimensions) => boolean;
10
- export declare const resizeBestFit: (term: IPty, userDimensions: Hash<dimensions>) => void;
10
+ export declare const resizeBestFit: (term: IPty, userDimensions: Hash<dimensions>, shouldClearScreen?: boolean) => void;
@@ -17,10 +17,12 @@ export const getDimensions = () => {
17
17
  export const areDimensionEqual = (a, b) => {
18
18
  return a.rows === b.rows && a.cols === b.cols;
19
19
  };
20
- export const resizeBestFit = (term, userDimensions) => {
20
+ export const resizeBestFit = (term, userDimensions, shouldClearScreen = false) => {
21
21
  const allViewports = Object.values(userDimensions);
22
22
  const minrows = Math.min(...allViewports.map((d) => d.rows));
23
23
  const mincols = Math.min(...allViewports.map((d) => d.cols));
24
24
  term.resize(mincols, minrows);
25
- term.write("\x0c"); // clear screen
25
+ if (shouldClearScreen) {
26
+ term.write('\x0c'); // clear screen
27
+ }
26
28
  };
@@ -84,7 +84,7 @@ export const teletypeApp = (options) => {
84
84
  switch (t) {
85
85
  case MessageType.DIMENSIONS:
86
86
  userDimensions[session] = d;
87
- resizeBestFit(term, userDimensions);
87
+ resizeBestFit(term, userDimensions, d.initial);
88
88
  break;
89
89
  case MessageType.IN:
90
90
  const data = decrypt(d, options.roomKey);
@@ -85,5 +85,5 @@
85
85
  ]
86
86
  }
87
87
  },
88
- "version": "2.0.3"
88
+ "version": "2.0.4"
89
89
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oorja",
3
3
  "description": "stream terminals to the web and more.",
4
- "version": "2.0.3",
4
+ "version": "2.0.4",
5
5
  "keywords": [
6
6
  "teletype",
7
7
  "terminal",