diff --git a/.eslintrc.json b/.eslintrc.json index 64d99769..2f39fada 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -32,22 +32,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": { @@ -56,15 +56,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", @@ -77,7 +77,7 @@ } ], "@typescript-eslint/naming-convention": [ - "error", + "warn", { "selector": "default", "format": ["camelCase"] }, // variableLike { "selector": "variable", "format": ["camelCase", "UPPER_CASE"] }, @@ -93,19 +93,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", @@ -113,43 +113,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/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index ba8dbc07..f5505689 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -110,8 +110,12 @@ 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 it exists. + if (!result && currentSelection) { + searchPosition.startRow = currentSelection.startRow; + searchPosition.startCol = 0; + result = this._findInLine(term, searchPosition, searchOptions); + } // Set selection and scroll if a result was found return this._selectResult(result); @@ -175,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) { diff --git a/package.json b/package.json index db3aea78..3d05b39c 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", diff --git a/src/browser/ScreenDprMonitor.ts b/src/browser/ScreenDprMonitor.ts index ec8c6d8a..27ae231f 100644 --- a/src/browser/ScreenDprMonitor.ts +++ b/src/browser/ScreenDprMonitor.ts @@ -44,12 +44,12 @@ 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); + this._resolutionMediaMatchList?.removeListener(this._outerListener); // Add listeners for new DPR this._currentDevicePixelRatio = window.devicePixelRatio;