Merge branch 'master' into add-osc-4

This commit is contained in:
Slawek Zachcial
2020-11-03 18:57:51 +01:00
committed by GitHub
14 changed files with 245 additions and 1676 deletions
+16 -13
View File
@@ -1,16 +1,19 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es2017", "target": "es2017",
"module": "commonjs", "module": "commonjs",
"sourceMap": true, "sourceMap": true,
"outDir": "../out", "outDir": "../out",
"rootDir": ".", "rootDir": ".",
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"preserveWatchOutput": true "preserveWatchOutput": true,
}, "types": [
"include": [ "../../../node_modules/@types/mocha"
"./**/*",
"../../../typings/xterm.d.ts"
] ]
},
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
]
} }
+2 -2
View File
@@ -359,7 +359,7 @@ function empty(ar) {
} }
function* parseMultiLineGen(filename, s) { function* parseMultiLineGen(filename, s) {
if (!~s.indexOf('@vt:')) { if (!s.includes('@vt:')) {
return; return;
} }
const lines = s.split('\n').map(el => el.trim().replace(/[*]/, '').replace(/\s/, '')); const lines = s.split('\n').map(el => el.trim().replace(/[*]/, '').replace(/\s/, ''));
@@ -413,7 +413,7 @@ function parseSingleLine(filename, s) {
const line = s.trim(); const line = s.trim();
const match = line.match(REX_VT_LINE); const match = line.match(REX_VT_LINE);
if (match !== null) { if (match !== null) {
if (!~TYPES.indexOf(match[2])) { if (!TYPES.includes(match[2])) {
throw new Error(`unkown vt-command type "${match[2]}" specified in "${filename}"`); throw new Error(`unkown vt-command type "${match[2]}" specified in "${filename}"`);
} }
return { return {
+2 -2
View File
@@ -25,7 +25,7 @@ if (fs.existsSync(addonsPath)) {
// walk all addon folders // walk all addon folders
fs.readdir(addonsPath, (err, files) => { fs.readdir(addonsPath, (err, files) => {
files.forEach(folder => { for (const folder of files) {
const addonPath = path.join(addonsPath, folder); const addonPath = path.join(addonsPath, folder);
// install only if there are dependencies listed // install only if there are dependencies listed
@@ -51,6 +51,6 @@ if (fs.existsSync(addonsPath)) {
} else { } else {
console.log('Skipped', folder); console.log('Skipped', folder);
} }
}); }
}); });
} }
+5 -5
View File
@@ -11,7 +11,7 @@ const path = require('path');
// Setup auth // Setup auth
fs.writeFileSync(`${process.env['HOME']}/.npmrc`, `//registry.npmjs.org/:_authToken=${process.env['NPM_AUTH_TOKEN']}`); fs.writeFileSync(`${process.env['HOME']}/.npmrc`, `//registry.npmjs.org/:_authToken=${process.env['NPM_AUTH_TOKEN']}`);
const isDryRun = process.argv.indexOf('--dry') !== -1; const isDryRun = process.argv.includes('--dry');
if (isDryRun) { if (isDryRun) {
console.log('Publish dry run'); console.log('Publish dry run');
} }
@@ -36,13 +36,13 @@ const addonPackageDirs = [
path.resolve(__dirname, '../addons/xterm-addon-webgl') path.resolve(__dirname, '../addons/xterm-addon-webgl')
]; ];
console.log(`Checking if addons need to be published`); console.log(`Checking if addons need to be published`);
addonPackageDirs.forEach(p => { for (const p of addonPackageDirs) {
const addon = path.basename(p); const addon = path.basename(p);
if (changedFiles.some(e => e.indexOf(addon) !== -1)) { if (changedFiles.some(e => e.includes(addon))) {
console.log(`Try publish ${addon}`); console.log(`Try publish ${addon}`);
checkAndPublishPackage(p); checkAndPublishPackage(p);
} }
}); }
// Publish website if it's a stable release // Publish website if it's a stable release
if (isStableRelease) { if (isStableRelease) {
@@ -54,7 +54,7 @@ function checkAndPublishPackage(packageDir) {
// Determine if this is a stable or beta release // Determine if this is a stable or beta release
const publishedVersions = getPublishedVersions(packageJson); const publishedVersions = getPublishedVersions(packageJson);
const isStableRelease = publishedVersions.indexOf(packageJson.version) === -1; const isStableRelease = !publishedVersions.includes(packageJson.version);
// Get the next version // Get the next version
let nextVersion = isStableRelease ? packageJson.version : getNextBetaVersion(packageJson); let nextVersion = isStableRelease ? packageJson.version : getNextBetaVersion(packageJson);
+5 -5
View File
@@ -88,19 +88,19 @@ function evalButtonCode(code) {
if (code & 64) { if (code & 64) {
button |= 4 button |= 4
} }
let actionS = 'press'; let action = 'press';
let buttonS = reverseButtons[button]; let buttonS = reverseButtons[button];
if (button === 3) { if (button === 3) {
buttonS = '<none>'; buttonS = '<none>';
actionS = 'release'; action = 'release';
} }
if (move) { if (move) {
actionS = 'move'; action = 'move';
} else if (4 <= button && button <= 7) { } else if (4 <= button && button <= 7) {
buttonS = 'wheel'; buttonS = 'wheel';
actionS = button === 4 ? 'up' : button === 5 ? 'down' : button === 6 ? 'left' : 'right'; action = button === 4 ? 'up' : button === 5 ? 'down' : button === 6 ? 'left' : 'right';
} }
return {button: buttonS, action: actionS, modifier}; return {button: buttonS, action, modifier};
} }
// protocols // protocols
+2 -2
View File
@@ -52,7 +52,7 @@
"express-ws": "^4.0.0", "express-ws": "^4.0.0",
"glob": "^7.0.5", "glob": "^7.0.5",
"jsdom": "^16.4.0", "jsdom": "^16.4.0",
"mocha": "^8.2.0", "mocha": "^8.2.1",
"mustache": "^4.0.1", "mustache": "^4.0.1",
"node-pty": "^0.9.0", "node-pty": "^0.9.0",
"nyc": "^15.1.0", "nyc": "^15.1.0",
@@ -61,7 +61,7 @@
"ts-loader": "^8.0.7", "ts-loader": "^8.0.7",
"typescript": "4.0", "typescript": "4.0",
"utf8": "^3.0.0", "utf8": "^3.0.0",
"webpack": "^4.44.2", "webpack": "^5.3.2",
"webpack-cli": "^4.1.0", "webpack-cli": "^4.1.0",
"ws": "^7.3.1", "ws": "^7.3.1",
"xterm-benchmark": "^0.1.3" "xterm-benchmark": "^0.1.3"
+2 -2
View File
@@ -32,7 +32,7 @@ if (os.platform() === 'darwin') {
); );
} }
// filter skipFilenames // filter skipFilenames
const FILES = TESTFILES.filter(value => SKIP_FILES.indexOf(value.split('/').slice(-1)[0]) === -1); const FILES = TESTFILES.filter(value => !SKIP_FILES.includes(value.split('/').slice(-1)[0]));
describe('Escape Sequence Files', function(): void { describe('Escape Sequence Files', function(): void {
this.timeout(1000); this.timeout(1000);
@@ -104,7 +104,7 @@ describe('Escape Sequence Files', function(): void {
function formatError(input: string, output: string, expected: string): string { function formatError(input: string, output: string, expected: string): string {
function addLineNumber(start: number, color: string): (s: string) => string { function addLineNumber(start: number, color: string): (s: string) => string {
let counter = start || 0; let counter = start || 0;
return function(s: string): string { return (s: string): string => {
counter += 1; counter += 1;
return '\x1b[33m' + (' ' + counter).slice(-2) + color + s; return '\x1b[33m' + (' ' + counter).slice(-2) + color + s;
}; };
+1
View File
@@ -4,6 +4,7 @@
"lib": [ "lib": [
"dom", "dom",
"es2015", "es2015",
"es2016.Array.Include"
], ],
"outDir": "../../out", "outDir": "../../out",
"types": [ "types": [
+1 -1
View File
@@ -17,7 +17,7 @@ const isNode = (typeof navigator === 'undefined') ? true : false;
const userAgent = (isNode) ? 'node' : navigator.userAgent; const userAgent = (isNode) ? 'node' : navigator.userAgent;
const platform = (isNode) ? 'node' : navigator.platform; const platform = (isNode) ? 'node' : navigator.platform;
export const isFirefox = !!~userAgent.indexOf('Firefox'); export const isFirefox = userAgent.includes('Firefox');
export const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent); export const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);
// Find the users platform. We use this to interpret the meta key // Find the users platform. We use this to interpret the meta key
+12 -12
View File
@@ -700,7 +700,7 @@ describe('Buffer', () => {
} }
const wrappedLines: number[] = []; const wrappedLines: number[] = [];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -723,7 +723,7 @@ describe('Buffer', () => {
} }
const wrappedLines: number[] = []; const wrappedLines: number[] = [];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -754,7 +754,7 @@ describe('Buffer', () => {
} }
const wrappedLines: number[] = []; const wrappedLines: number[] = [];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -777,7 +777,7 @@ describe('Buffer', () => {
} }
const wrappedLines: number[] = []; const wrappedLines: number[] = [];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -814,7 +814,7 @@ describe('Buffer', () => {
} }
const wrappedLines: number[] = []; const wrappedLines: number[] = [];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -837,7 +837,7 @@ describe('Buffer', () => {
} }
const wrappedLines: number[] = []; const wrappedLines: number[] = [];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -891,7 +891,7 @@ describe('Buffer', () => {
} }
const wrappedLines = [1, 3, 5]; const wrappedLines = [1, 3, 5];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -917,7 +917,7 @@ describe('Buffer', () => {
} }
const wrappedLines = [1, 3, 5]; const wrappedLines = [1, 3, 5];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -950,7 +950,7 @@ describe('Buffer', () => {
} }
const wrappedLines = [11, 13, 15]; const wrappedLines = [11, 13, 15];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -975,7 +975,7 @@ describe('Buffer', () => {
} }
const wrappedLines = [11, 13, 15]; const wrappedLines = [11, 13, 15];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -1014,7 +1014,7 @@ describe('Buffer', () => {
} }
const wrappedLines = [8, 10, 12]; const wrappedLines = [8, 10, 12];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
@@ -1040,7 +1040,7 @@ describe('Buffer', () => {
} }
const wrappedLines = [8, 10, 12]; const wrappedLines = [8, 10, 12];
for (let i = 0; i < buffer.lines.length; i++) { for (let i = 0; i < buffer.lines.length; i++) {
assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.indexOf(i) !== -1, `line ${i} isWrapped must equal ${wrappedLines.indexOf(i) !== -1}`); assert.equal(buffer.lines.get(i)!.isWrapped, wrappedLines.includes(i), `line ${i} isWrapped must equal ${wrappedLines.includes(i)}`);
} }
}); });
}); });
+1 -1
View File
@@ -161,7 +161,7 @@ it('wcwidth should match all values from the old implementation', function(): vo
// ==> n = n >> m e.g. m=12 000000000000FFEEDDCCBBAA99887766 // ==> n = n >> m e.g. m=12 000000000000FFEEDDCCBBAA99887766
// we are only interested in 2 LSBs, cut off higher bits // we are only interested in 2 LSBs, cut off higher bits
// ==> n = n & 3 e.g. 000000000000000000000000000000XX // ==> n = n & 3 e.g. 000000000000000000000000000000XX
return function (num: number): number { return (num: number): number => {
num = num | 0; // get asm.js like optimization under V8 num = num | 0; // get asm.js like optimization under V8
if (num < 32) { if (num < 32) {
return control | 0; return control | 0;
+2 -2
View File
@@ -89,7 +89,7 @@ export class OptionsService implements IOptionsService {
if (!(key in DEFAULT_OPTIONS)) { if (!(key in DEFAULT_OPTIONS)) {
throw new Error('No option with key "' + key + '"'); throw new Error('No option with key "' + key + '"');
} }
if (CONSTRUCTOR_ONLY_OPTIONS.indexOf(key) !== -1) { if (CONSTRUCTOR_ONLY_OPTIONS.includes(key)) {
throw new Error(`Option "${key}" can only be set in the constructor`); throw new Error(`Option "${key}" can only be set in the constructor`);
} }
if (this.options[key] === value) { if (this.options[key] === value) {
@@ -123,7 +123,7 @@ export class OptionsService implements IOptionsService {
// already valid numeric value // already valid numeric value
break; break;
} }
value = FONT_WEIGHT_OPTIONS.indexOf(value) !== -1 ? value : DEFAULT_OPTIONS[key]; value = FONT_WEIGHT_OPTIONS.includes(value) ? value : DEFAULT_OPTIONS[key];
break; break;
case 'cursorWidth': case 'cursorWidth':
value = Math.floor(value); value = Math.floor(value);
+2 -1
View File
@@ -2,7 +2,8 @@
"extends": "../tsconfig-library-base", "extends": "../tsconfig-library-base",
"compilerOptions": { "compilerOptions": {
"lib": [ "lib": [
"es2015" "es2015",
"es2016.Array.Include"
], ],
"outDir": "../../out", "outDir": "../../out",
"types": [ "types": [
+192 -1628
View File
File diff suppressed because it is too large Load Diff