Wiring in majority of minimap-view Part 2; Fixing keybinding select and move of session; moved modals around

This commit is contained in:
2025-07-01 01:10:14 -05:00
parent 289c061ab6
commit a6b0bda263
15 changed files with 191 additions and 41 deletions

View File

@@ -90,8 +90,12 @@ export class CodeViewBase {
this.editor.showKeyboardShortcuts();
}
public search() {
console.log(this.editor.session.getMode()["$id"]);
public searchPopup() {
this.editor.execCommand("find");
}
public replacePopup() {
this.editor.execCommand("replace");
}
public showFilesList() {
@@ -161,8 +165,30 @@ export class CodeViewBase {
this.editor.setHighlightGutterLine(false);
this.editor.setShowFoldWidgets(false);
this.editor.setShowPrintMargin(false);
this.editorElm.nativeElement.parentElement.classList.remove("scroller");
this.editorElm.nativeElement.parentElement.classList.add("col-1");
this.editorElm.nativeElement.parentElement.classList.add("zero-margin-padding");
this.editor.on("click", (event) => {
event.preventDefault();
event.stopPropagation();
let editorComponent = this.editorsService.getActiveEditorComponent();
let pos = this.editor.getCursorPosition();
editorComponent.editor.moveCursorToPosition(pos);
editorComponent.editor.clearSelection();
editorComponent.editor.renderer.scrollCursorIntoView();
});
this.editor.on("mousewheel", (event) => {
event.preventDefault();
event.stopPropagation();
let editorComponent = this.editorsService.getActiveEditorComponent();
editorComponent.editor.renderer.scrollBy(null, event.domEvent.deltaY);
});
}
public zoomIn() {
@@ -223,4 +249,4 @@ export class CodeViewBase {
private quit() {
window.main.quit();
}
}
}

View File

@@ -6,6 +6,8 @@ import "ace-builds/src-noconflict/ext-settings_menu";
import "ace-builds/src-noconflict/ext-keybinding_menu";
import "ace-builds/src-noconflict/ext-command_bar";
import "ace-builds/src-noconflict/ext-prompt";
import "ace-builds/src-noconflict/ext-code_lens";
import "ace-builds/src-noconflict/ext-searchbox";
import "ace-builds/src-noconflict/ext-language_tools";
//import "ace-builds/src-noconflict/theme-one_dark";
//import "ace-builds/src-noconflict/theme-penguins_in_space";
@@ -26,7 +28,7 @@ import { ServiceMessage } from '../../common/types/service-message.type';
templateUrl: './view.component.html',
styleUrl: './view.component.css',
host: {
'class': 'col zero-margin-padding'
'class': 'col zero-margin-padding scroller'
}
})
export class CodeViewComponent extends CodeViewBase {
@@ -157,6 +159,23 @@ export class CodeViewComponent extends CodeViewBase {
this.editor.setSession(session);
}
public assignSession(file: NewtonFile) {
if (!file) return;
this.activeFile = file;
this.editor.setSession(file.session);
}
public cloneSession(file: NewtonFile) {
if (!file) return;
this.activeFile = file;
let session = ace.createEditSession(file.session.getValue());
session.setMode( file.session.getMode()["$id"] );
this.editor.setSession(session);
}
protected openFiles() {
let startDir = "";
if (this.activeFile) {

View File

@@ -75,8 +75,7 @@ export class EditorsComponent {
if (session == siblingSession) return;
siblingComponent.editor.setSession(session);
siblingComponent.activeFile = editorComponent.activeFile;
siblingComponent.assignSession(editorComponent.activeFile);
editorComponent.newSession();
siblingComponent.editor.focus()
@@ -90,8 +89,7 @@ export class EditorsComponent {
if (session == siblingSession) return;
siblingComponent.editor.setSession(session);
siblingComponent.activeFile = editorComponent.activeFile;
siblingComponent.assignSession(editorComponent.activeFile);
editorComponent.newSession();
siblingComponent.editor.focus()
@@ -104,10 +102,8 @@ export class EditorsComponent {
let editorComponent = this.editorsService.getActiveEditorComponent();
let editor = editorComponent.editor;
editorComponent.activeFile = file;
editor.setSession(file.session);
this.editorsService.miniMapView.editor.setSession(file.session);
this.editorsService.miniMapView.activeFile = file;
editorComponent.assignSession(file);
this.editorsService.miniMapView.cloneSession(file);
} else if (message.action === "close-tab") {
let file = this.filesService.get(message.filePath);
let editors = this.editorsService.getEditorsAsArray();