Delete line command (#866)

pull/873/head
pihentagy 2024-05-25 23:12:48 +02:00 committed by GitHub
parent 827b08c21f
commit 0e3c5587f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 2 deletions

View File

@ -1,4 +1,4 @@
This folder contains two things:
* Wrappers for `syscall`s to be used by Plugs
* Reusablee library code that plugs may find useful
* Reusable library code that plugs may find useful

View File

@ -211,3 +211,7 @@ export function openSearchPanel() {
export function copyToClipboard(data: string | Blob): Promise<void> {
return syscall("editor.copyToClipboard", data);
}
export function deleteLine() {
return syscall("editor.deleteLine");
}

View File

@ -163,6 +163,12 @@ functions:
name: "Navigate: Center Cursor"
key: "Ctrl-Alt-l"
requireMode: rw
deleteLine:
path: "./editor.ts:deleteLineCommand"
command:
name: "Delete Line"
key: "Ctrl-d"
requireMode: rw
# Debug commands
parseCommand:

View File

@ -64,3 +64,7 @@ export function undoCommand() {
export function redoCommand() {
return editor.redo();
}
export function deleteLineCommand() {
return editor.deleteLine();
}

View File

@ -6,7 +6,7 @@ import {
unfoldAll,
unfoldCode,
} from "@codemirror/language";
import { redo, undo } from "@codemirror/commands";
import { deleteLine, redo, undo } from "@codemirror/commands";
import { Transaction } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import { getCM as vimGetCm, Vim } from "@replit/codemirror-vim";
@ -272,6 +272,9 @@ export function editorSyscalls(client: Client): SysCallMapping {
context: client.getContext(),
});
},
"editor.deleteLine": () => {
deleteLine(client.editorView);
},
// Folding
"editor.fold": () => {
foldCode(client.editorView);