Compare commits
2 Commits
9f201a3dac
...
c4ab66141c
| Author | SHA1 | Date | |
|---|---|---|---|
| c4ab66141c | |||
| 6bedb69909 |
21
package.json
21
package.json
@@ -30,10 +30,7 @@
|
|||||||
"icon": "./icos/",
|
"icon": "./icos/",
|
||||||
"files": [
|
"files": [
|
||||||
"newton/",
|
"newton/",
|
||||||
"build/",
|
"build/"
|
||||||
"!node_modules/ace-builds/",
|
|
||||||
"!node_modules/web-streams-polyfill/",
|
|
||||||
"!node_modules/@angular/"
|
|
||||||
],
|
],
|
||||||
"mac": {
|
"mac": {
|
||||||
"category": "public.app-category.developer-tools"
|
"category": "public.app-category.developer-tools"
|
||||||
@@ -49,13 +46,7 @@
|
|||||||
},
|
},
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/cdk": "19.2.0",
|
|
||||||
"@angular/common": "19.2.0",
|
|
||||||
"@angular/core": "19.2.0",
|
|
||||||
"@angular/forms": "19.2.0",
|
|
||||||
"@angular/platform-browser": "19.2.0",
|
|
||||||
"@xterm/xterm": "5.5.0",
|
"@xterm/xterm": "5.5.0",
|
||||||
"ace-builds": "1.43.0",
|
|
||||||
"ace-diff": "3.0.3",
|
"ace-diff": "3.0.3",
|
||||||
"ace-layout": "1.5.0",
|
"ace-layout": "1.5.0",
|
||||||
"ace-linters": "1.8.3",
|
"ace-linters": "1.8.3",
|
||||||
@@ -66,16 +57,21 @@
|
|||||||
"express": "4.18.2",
|
"express": "4.18.2",
|
||||||
"marked": "16.4.0",
|
"marked": "16.4.0",
|
||||||
"node-fetch": "3.3.2",
|
"node-fetch": "3.3.2",
|
||||||
"node-pty": "^1.0.0",
|
"node-pty": "1.0.0",
|
||||||
"rxjs": "7.8.0",
|
|
||||||
"socket.io": "4.8.1",
|
"socket.io": "4.8.1",
|
||||||
"uuid": "11.1.0",
|
"uuid": "11.1.0",
|
||||||
"zone.js": "0.15.0"
|
"zone.js": "0.15.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"ace-builds": "1.43.0",
|
||||||
"@angular-devkit/build-angular": "19.2.8",
|
"@angular-devkit/build-angular": "19.2.8",
|
||||||
|
"@angular/cdk": "19.2.0",
|
||||||
|
"@angular/common": "19.2.0",
|
||||||
|
"@angular/core": "19.2.0",
|
||||||
"@angular/cli": "19.2.8",
|
"@angular/cli": "19.2.8",
|
||||||
"@angular/compiler-cli": "19.2.0",
|
"@angular/compiler-cli": "19.2.0",
|
||||||
|
"@angular/forms": "19.2.0",
|
||||||
|
"@angular/platform-browser": "19.2.0",
|
||||||
"@types/express": "4.17.17",
|
"@types/express": "4.17.17",
|
||||||
"@types/jasmine": "5.1.0",
|
"@types/jasmine": "5.1.0",
|
||||||
"@types/node": "18.18.0",
|
"@types/node": "18.18.0",
|
||||||
@@ -91,6 +87,7 @@
|
|||||||
"karma-jasmine": "5.1.0",
|
"karma-jasmine": "5.1.0",
|
||||||
"karma-jasmine-html-reporter": "2.1.0",
|
"karma-jasmine-html-reporter": "2.1.0",
|
||||||
"nanoevents": "9.1.0",
|
"nanoevents": "9.1.0",
|
||||||
|
"rxjs": "7.8.0",
|
||||||
"tree-sitter": "0.21.1",
|
"tree-sitter": "0.21.1",
|
||||||
"tree-sitter-bash": "0.23.2",
|
"tree-sitter-bash": "0.23.2",
|
||||||
"tree-sitter-c": "0.23.1",
|
"tree-sitter-c": "0.23.1",
|
||||||
|
|||||||
@@ -1,7 +1,21 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-3">
|
<div class="col col-3">
|
||||||
<label id="find-status-lbl">Find in Current File</label>
|
@if (isQueryLong) {
|
||||||
|
<label id="find-status-lbl">
|
||||||
|
<b class="error">Query exceeds 80 characters...</b>
|
||||||
|
</label>
|
||||||
|
} @else if (isQueryNotFound) {
|
||||||
|
<label id="find-status-lbl">
|
||||||
|
<b class="warning">Query not found...</b>
|
||||||
|
</label>
|
||||||
|
} @else if (query && !isQueryLong && !isQueryNotFound) {
|
||||||
|
<label id="find-status-lbl">Found in current file:
|
||||||
|
<b class="success">{{totalCount}}</b>
|
||||||
|
</label>
|
||||||
|
} @else {
|
||||||
|
<label id="find-status-lbl">Find in Current File:</label>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col col-4">
|
<div class="col col-4">
|
||||||
@@ -45,15 +59,27 @@
|
|||||||
id="find-entry"
|
id="find-entry"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
type="search"
|
type="search"
|
||||||
(keyup)="searchForString()"
|
(focus)="searchForString()"
|
||||||
|
(keyup)="findEntryKeyUpHandler($event)"
|
||||||
|
(input)="searchForString()"
|
||||||
placeholder="Find in current file..."
|
placeholder="Find in current file..."
|
||||||
aria-label="Find in current file..."
|
aria-label="Find in current file..."
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-auto">
|
<div class="col col-auto">
|
||||||
<button id="find-btn" class="width-8em btn btn-sm btn-dark" (click)="findNextEntry()">Find</button>
|
<button
|
||||||
<button id="find-all-btn" class="width-8em btn btn-sm btn-dark" (click)="findAllEntries()">Find All</button>
|
[disabled]="!query || isQueryLong || isQueryNotFound"
|
||||||
|
id="find-btn"
|
||||||
|
class="width-8em btn btn-sm btn-dark"
|
||||||
|
(click)="findNextEntry()">Find
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
[disabled]="!query || isQueryLong || isQueryNotFound"
|
||||||
|
id="find-all-btn"
|
||||||
|
class="width-8em btn btn-sm btn-dark"
|
||||||
|
(click)="findAllEntries()">Find All
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -68,15 +94,25 @@
|
|||||||
id="replace-entry"
|
id="replace-entry"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
type="search"
|
type="search"
|
||||||
(keyup)="replaceEntry($event)"
|
(keyup.enter)="replaceEntry($event)"
|
||||||
title="Replace in current file..."
|
title="Replace in current file..."
|
||||||
placeholder="Replace in current file..."
|
placeholder="Replace in current file..."
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-auto">
|
<div class="col col-auto">
|
||||||
<button id="replace-btn" class="width-8em btn btn-sm btn-dark" (click)="replaceEntry($event)">Replace</button>
|
<button
|
||||||
<button id="replace-all-btn" class="width-8em btn btn-sm btn-dark" (click)="replaceAll()">Replace All</button>
|
[disabled]="!query || isQueryLong || isQueryNotFound"
|
||||||
|
id="replace-btn"
|
||||||
|
class="width-8em btn btn-sm btn-dark"
|
||||||
|
(click)="replaceEntry($event)">Replace
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
[disabled]="!query || isQueryLong || isQueryNotFound"
|
||||||
|
id="replace-all-btn"
|
||||||
|
class="width-8em btn btn-sm btn-dark"
|
||||||
|
(click)="replaceAll()">Replace All
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -36,15 +36,19 @@ export class SearchReplaceComponent {
|
|||||||
@ViewChild('findEntryElm') findEntryElm!: ElementRef;
|
@ViewChild('findEntryElm') findEntryElm!: ElementRef;
|
||||||
@ViewChild('replaceEntryElm') replaceEntryElm!: ElementRef;
|
@ViewChild('replaceEntryElm') replaceEntryElm!: ElementRef;
|
||||||
|
|
||||||
|
@Input() query: string = "";
|
||||||
|
@Input() findOptions: string = "";
|
||||||
|
@Input() isQueryLong: boolean = false;
|
||||||
|
@Input() isQueryNotFound: boolean = false;
|
||||||
|
@Input() totalCount: number = 0;
|
||||||
|
|
||||||
private editor!: any;
|
private editor!: any;
|
||||||
|
|
||||||
@Input() findOptions: string = "";
|
|
||||||
private useWholeWordSearch: boolean = false;
|
private useWholeWordSearch: boolean = false;
|
||||||
private searchOnlyInSelection: boolean = false;
|
private searchOnlyInSelection: boolean = false;
|
||||||
private useCaseSensitive: boolean = false;
|
private useCaseSensitive: boolean = false;
|
||||||
private useRegex: boolean = false;
|
private useRegex: boolean = false;
|
||||||
private selection: string = "";
|
private selection: string = "";
|
||||||
private query: string = "";
|
|
||||||
private toStr: string = "";
|
private toStr: string = "";
|
||||||
private isBackwards: boolean = false;
|
private isBackwards: boolean = false;
|
||||||
private isWrap: boolean = true;
|
private isWrap: boolean = true;
|
||||||
@@ -179,17 +183,25 @@ export class SearchReplaceComponent {
|
|||||||
this.findOptions = findOptionsStr;
|
this.findOptions = findOptionsStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public findPreviousEntry() {
|
||||||
|
this.editor.findPrevious();
|
||||||
|
}
|
||||||
|
|
||||||
public findNextEntry() {
|
public findNextEntry() {
|
||||||
this.editor.findNext();
|
this.editor.findNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public findEntryKeyUpHandler(event: KeyboardEvent) {
|
||||||
|
if (!event.ctrlKey || !this.query) return;
|
||||||
|
|
||||||
|
if (event.key === "ArrowUp") this.findPreviousEntry();
|
||||||
|
if (event.key === "ArrowDown") this.findNextEntry();
|
||||||
|
}
|
||||||
|
|
||||||
public findAllEntries() {
|
public findAllEntries() {
|
||||||
this.query = this.findEntryElm.nativeElement.value;
|
this.query = this.findEntryElm.nativeElement.value;
|
||||||
|
|
||||||
if (!this.query) return;
|
this.totalCount = this.editor.findAll(this.query, {
|
||||||
|
|
||||||
let totalCount = this.editor.findAll(this.query, {
|
|
||||||
backwards: this.isBackwards,
|
backwards: this.isBackwards,
|
||||||
wrap: this.isWrap,
|
wrap: this.isWrap,
|
||||||
caseSensitive: this.useCaseSensitive,
|
caseSensitive: this.useCaseSensitive,
|
||||||
@@ -197,25 +209,19 @@ export class SearchReplaceComponent {
|
|||||||
regExp: this.useRegex,
|
regExp: this.useRegex,
|
||||||
range: this.searchOnlyInSelection
|
range: this.searchOnlyInSelection
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.totalCount === 0) this.isQueryNotFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public findPreviousEntry() {
|
public replaceEntry(event: KeyboardEvent) {
|
||||||
this.editor.findPrevious();
|
if (this.isQueryLong || this.isQueryNotFound) return;
|
||||||
}
|
|
||||||
|
|
||||||
public replaceEntry(event: any) {
|
|
||||||
if (event instanceof KeyboardEvent) {
|
|
||||||
if (event.key !== "Enter") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let fromStr = this.findEntryElm.nativeElement.value;
|
let fromStr = this.findEntryElm.nativeElement.value;
|
||||||
let toStr = this.replaceEntryElm.nativeElement.value;
|
let toStr = this.replaceEntryElm.nativeElement.value;
|
||||||
|
|
||||||
if (!fromStr) return;
|
if (!fromStr) return;
|
||||||
|
|
||||||
let totalCount = this.editor.replace(toStr, fromStr, {
|
this.editor.replace(toStr, fromStr, {
|
||||||
backwards: this.isBackwards,
|
backwards: this.isBackwards,
|
||||||
wrap: this.isWrap,
|
wrap: this.isWrap,
|
||||||
caseSensitive: this.useCaseSensitive,
|
caseSensitive: this.useCaseSensitive,
|
||||||
@@ -229,12 +235,14 @@ export class SearchReplaceComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public replaceAll() {
|
public replaceAll() {
|
||||||
|
if (this.isQueryLong || this.isQueryNotFound) return;
|
||||||
|
|
||||||
let fromStr = this.findEntryElm.nativeElement.value;
|
let fromStr = this.findEntryElm.nativeElement.value;
|
||||||
let toStr = this.replaceEntryElm.nativeElement.value;
|
let toStr = this.replaceEntryElm.nativeElement.value;
|
||||||
|
|
||||||
if (!fromStr) return;
|
if (!fromStr) return;
|
||||||
|
|
||||||
let totalCount = this.editor.replaceAll(toStr, fromStr, {
|
this.editor.replaceAll(toStr, fromStr, {
|
||||||
backwards: this.isBackwards,
|
backwards: this.isBackwards,
|
||||||
wrap: this.isWrap,
|
wrap: this.isWrap,
|
||||||
caseSensitive: this.useCaseSensitive,
|
caseSensitive: this.useCaseSensitive,
|
||||||
@@ -242,23 +250,27 @@ export class SearchReplaceComponent {
|
|||||||
regExp: this.useRegex,
|
regExp: this.useRegex,
|
||||||
range: this.searchOnlyInSelection
|
range: this.searchOnlyInSelection
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.isQueryNotFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public searchForString() {
|
public searchForString() {
|
||||||
if (event instanceof KeyboardEvent) {
|
if (this.searchTimeoutId) { clearTimeout(this.searchTimeoutId); }
|
||||||
if (event.key !== "Enter") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.query = this.findEntryElm.nativeElement.value;
|
this.query = this.findEntryElm.nativeElement.value;
|
||||||
|
|
||||||
if (!this.query) return;
|
if (!this.query) {
|
||||||
|
this.isQueryLong = false;
|
||||||
|
this.isQueryNotFound = false;
|
||||||
|
|
||||||
if (this.searchTimeoutId) { clearTimeout(this.searchTimeoutId); }
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isQueryLong = (this.query.length > 80);
|
||||||
|
if (this.isQueryLong) return;
|
||||||
|
|
||||||
this.searchTimeoutId = setTimeout(() => {
|
this.searchTimeoutId = setTimeout(() => {
|
||||||
let totalCount = this.editor.find(this.query, {
|
this.totalCount = this.editor.findAll(this.query, {
|
||||||
backwards: this.isBackwards,
|
backwards: this.isBackwards,
|
||||||
wrap: this.isWrap,
|
wrap: this.isWrap,
|
||||||
caseSensitive: this.useCaseSensitive,
|
caseSensitive: this.useCaseSensitive,
|
||||||
@@ -266,6 +278,8 @@ export class SearchReplaceComponent {
|
|||||||
regExp: this.useRegex,
|
regExp: this.useRegex,
|
||||||
range: this.searchOnlyInSelection
|
range: this.searchOnlyInSelection
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.isQueryNotFound = (this.totalCount === 0);
|
||||||
}, this.searchTimeout);
|
}, this.searchTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user