From 628140562f6bcd3e8261a7477311f157a2cb528c Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Mon, 6 Jul 2020 21:41:08 +0300 Subject: [PATCH] remove handling of jumping to beginning of line --- codejar.ts | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/codejar.ts b/codejar.ts index fa6c80d..26dfc08 100644 --- a/codejar.ts +++ b/codejar.ts @@ -72,7 +72,6 @@ export function CodeJar(editor: HTMLElement, highlight: (e: HTMLElement) => void prev = toString() handleNewLine(event) handleTabCharacters(event) - handleJumpToBeginningOfLine(event) handleSelfClosingCharacters(event) handleUndoRedo(event) if (shouldRecord(event) && !recording) { @@ -283,29 +282,6 @@ export function CodeJar(editor: HTMLElement, highlight: (e: HTMLElement) => void } } - function handleJumpToBeginningOfLine(event: KeyboardEvent) { - if (event.key === "ArrowLeft" && event.metaKey) { - preventDefault(event) - const before = beforeCursor() - let [padding, start, end] = findPadding(before) - if (before.endsWith(padding)) { - if (event.shiftKey) { - const pos = save() - restore({start, end: pos.end}) // Select from line start. - } else { - restore({start, end: start}) // Jump to line start. - } - } else { - if (event.shiftKey) { - const pos = save() - restore({start: end, end: pos.end}) // Select from beginning of text. - } else { - restore({start: end, end}) // Jump to beginning of text. - } - } - } - } - function handleUndoRedo(event: KeyboardEvent) { if (isUndo(event)) { preventDefault(event)