From 50ba6bfa1b32093241070ec2ce89443226ba6f27 Mon Sep 17 00:00:00 2001 From: rishab Date: Sat, 25 Apr 2020 03:13:19 -0700 Subject: [PATCH 1/6] Wrap search back if there exists a result in search Search must wrap back as it does when there are multiple lines. --- addons/xterm-addon-search/src/SearchAddon.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index ba8dbc07..fa473a71 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -110,8 +110,16 @@ export class SearchAddon implements ITerminalAddon { } } - // If there is only one result, return true. if (!result && currentSelection) return true; + // If there is only one result, wrap back and return selection if exists. + if (!result && currentSelection) { + searchPosition.startRow = currentSelection.startRow; + searchPosition.startCol = 0; + result = this._findInLine(term, searchPosition, searchOptions); + if (result) { + return this._selectResult(result); + } + } // Set selection and scroll if a result was found return this._selectResult(result); From 45ff3ee6379c2fb1c775fa953cd12eed77c932b5 Mon Sep 17 00:00:00 2001 From: rishab Date: Sat, 25 Apr 2020 03:13:32 -0700 Subject: [PATCH 2/6] Update SearchAddon.ts --- addons/xterm-addon-search/src/SearchAddon.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index fa473a71..e22c8b7c 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -110,7 +110,6 @@ export class SearchAddon implements ITerminalAddon { } } - if (!result && currentSelection) return true; // If there is only one result, wrap back and return selection if exists. if (!result && currentSelection) { searchPosition.startRow = currentSelection.startRow; From 08f8f51adee6dfbfa19e1e6cbf6a377da456719a Mon Sep 17 00:00:00 2001 From: rishab Date: Sat, 25 Apr 2020 17:33:48 -0700 Subject: [PATCH 3/6] handle wrap back with find previous wrap back search selection to last selected result when we hit top --- addons/xterm-addon-search/src/SearchAddon.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index e22c8b7c..f5505689 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -110,14 +110,11 @@ export class SearchAddon implements ITerminalAddon { } } - // If there is only one result, wrap back and return selection if exists. + // If there is only one result, wrap back and return selection if it exists. if (!result && currentSelection) { searchPosition.startRow = currentSelection.startRow; searchPosition.startCol = 0; result = this._findInLine(term, searchPosition, searchOptions); - if (result) { - return this._selectResult(result); - } } // Set selection and scroll if a result was found @@ -182,7 +179,7 @@ export class SearchAddon implements ITerminalAddon { } // If we hit the top and didn't search from the very bottom wrap back down if (!result && startRow !== (this._terminal.buffer.active.baseY + this._terminal.rows)) { - for (let y = (this._terminal.buffer.active.baseY + this._terminal.rows); y > startRow; y--) { + for (let y = (this._terminal.buffer.active.baseY + this._terminal.rows); y >= startRow; y--) { searchPosition.startRow = y; result = this._findInLine(term, searchPosition, searchOptions, isReverseSearch); if (result) { From 40a09d74125535ae380f319d019d2074526bda51 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sat, 2 May 2020 16:20:46 +0200 Subject: [PATCH 4/6] fixed ScreenDprListener never being fired --- src/browser/ScreenDprMonitor.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/browser/ScreenDprMonitor.ts b/src/browser/ScreenDprMonitor.ts index ec8c6d8a..6bd4857e 100644 --- a/src/browser/ScreenDprMonitor.ts +++ b/src/browser/ScreenDprMonitor.ts @@ -44,12 +44,14 @@ export class ScreenDprMonitor extends Disposable { } private _updateDpr(): void { - if (!this._resolutionMediaMatchList || !this._outerListener) { + if (!this._outerListener) { return; } // Clear listeners for old DPR - this._resolutionMediaMatchList.removeListener(this._outerListener); + if (this._resolutionMediaMatchList) { + this._resolutionMediaMatchList.removeListener(this._outerListener); + } // Add listeners for new DPR this._currentDevicePixelRatio = window.devicePixelRatio; From 930de9aeb7fa25537a7b7ff1106fd95659c4e4b7 Mon Sep 17 00:00:00 2001 From: Eugene Date: Sat, 2 May 2020 22:48:30 +0200 Subject: [PATCH 5/6] Update src/browser/ScreenDprMonitor.ts Co-authored-by: Daniel Imms --- src/browser/ScreenDprMonitor.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/browser/ScreenDprMonitor.ts b/src/browser/ScreenDprMonitor.ts index 6bd4857e..27ae231f 100644 --- a/src/browser/ScreenDprMonitor.ts +++ b/src/browser/ScreenDprMonitor.ts @@ -49,9 +49,7 @@ export class ScreenDprMonitor extends Disposable { } // Clear listeners for old DPR - if (this._resolutionMediaMatchList) { - this._resolutionMediaMatchList.removeListener(this._outerListener); - } + this._resolutionMediaMatchList?.removeListener(this._outerListener); // Add listeners for new DPR this._currentDevicePixelRatio = window.devicePixelRatio; From b84831f14818729811754d6995d8830d5db80e49 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 3 May 2020 06:05:06 -0700 Subject: [PATCH 6/6] Make all eslint rules warnings eslint warnings normally don't exit with non-zero when warnings fail unless '--max-warnings 0' is used. This commit adds that and changes all rules to be warnings in order to improve feedback in the editor. After this commit all warning diagnostics (yellow) are stylistic/lint-related ones that will still fail lint, which error diagnostics (red) are actual errors that will fail compilation (from tsc). Fixes #2886 --- .eslintrc.json | 60 +++++++++++++++++++++++++------------------------- package.json | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 32f8e992..1d4c4895 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -30,22 +30,22 @@ ], "rules": { "@typescript-eslint/array-type": [ - "error", + "warn", { "default": "array-simple", "readonly": "generic" } ], - "@typescript-eslint/class-name-casing": "error", - "@typescript-eslint/consistent-type-definitions": "error", + "@typescript-eslint/class-name-casing": "warn", + "@typescript-eslint/consistent-type-definitions": "warn", "@typescript-eslint/explicit-function-return-type": [ - "error", + "warn", { "allowExpressions": true } ], "@typescript-eslint/explicit-member-accessibility": [ - "error", + "warn", { "accessibility": "explicit", "overrides": { @@ -54,15 +54,15 @@ } ], "@typescript-eslint/indent": [ - "error", + "warn", 2 ], "@typescript-eslint/interface-name-prefix": [ - "error", + "warn", "always" ], "@typescript-eslint/member-delimiter-style": [ - "error", + "warn", { "multiline": { "delimiter": "semi", @@ -75,7 +75,7 @@ } ], "@typescript-eslint/naming-convention": [ - "error", + "warn", { "selector": "default", "format": ["camelCase"] }, // variableLike { "selector": "variable", "format": ["camelCase", "UPPER_CASE"] }, @@ -91,19 +91,19 @@ { "selector": "typeLike", "format": ["PascalCase"] }, { "selector": "interface", "format": ["PascalCase"], "prefix": ["I"] } ], - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/type-annotation-spacing": "error", + "@typescript-eslint/prefer-namespace-keyword": "warn", + "@typescript-eslint/type-annotation-spacing": "warn", "@typescript-eslint/quotes": [ - "error", + "warn", "single", { "allowTemplateLiterals": true } ], "@typescript-eslint/semi": [ - "error", + "warn", "always" ], "comma-dangle": [ - "error", + "warn", { "objects": "never", "arrays": "never", @@ -111,43 +111,43 @@ } ], "curly": [ - "error", + "warn", "multi-line" ], - "eol-last": "error", + "eol-last": "warn", "eqeqeq": [ - "error", + "warn", "always" ], - "keyword-spacing": "error", - "new-parens": "error", - "no-duplicate-imports": "error", + "keyword-spacing": "warn", + "new-parens": "warn", + "no-duplicate-imports": "warn", "no-else-return": [ - "error", + "warn", { "allowElseIf": false } ], - "no-eval": "error", - "no-irregular-whitespace": "error", + "no-eval": "warn", + "no-irregular-whitespace": "warn", "no-restricted-imports": [ - "error", + "warn", { "patterns": [ ".*\\/out\\/.*" ] } ], - "no-trailing-spaces": "error", - "no-unsafe-finally": "error", - "no-var": "error", + "no-trailing-spaces": "warn", + "no-unsafe-finally": "warn", + "no-var": "warn", "one-var": [ - "error", + "warn", "never" ], - "prefer-const": "error", + "prefer-const": "warn", "spaced-comment": [ - "error", + "warn", "always", { "markers": ["/"], diff --git a/package.json b/package.json index f08004da..3ac35d2a 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "prepackage": "npm run build", "package": "webpack", "start": "node demo/start", - "lint": "eslint -c .eslintrc.json --ext .ts src/ addons/", + "lint": "eslint -c .eslintrc.json --max-warnings 0 --ext .ts src/ addons/", "test": "npm run test-unit", "posttest": "npm run lint", "test-api": "npm run test-api-chromium",