From 8bb3018e84b439bfdc62b4c612c464c7701ec028 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Fri, 10 Nov 2023 19:40:05 -0500 Subject: [PATCH] Minor reformatting tweak --- src/common/editor/ansi.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/common/editor/ansi.ts b/src/common/editor/ansi.ts index f46f649..bb5c20a 100644 --- a/src/common/editor/ansi.ts +++ b/src/common/editor/ansi.ts @@ -8,12 +8,14 @@ function esc(pieces: TemplateStringsArray): string { * ANSI escapes for various inputs */ export enum KeyCommand { - ArrowUp = `${ANSI_PREFIX}A`, - ArrowDown = `${ANSI_PREFIX}B`, - ArrowRight = `${ANSI_PREFIX}C`, - ArrowLeft = `${ANSI_PREFIX}D`, - PageUp = `${ANSI_PREFIX}5~`, - PageDown = `${ANSI_PREFIX}6~`, + ArrowUp = ANSI_PREFIX + 'A', + ArrowDown = ANSI_PREFIX + 'B', + ArrowRight = ANSI_PREFIX + 'C', + ArrowLeft = ANSI_PREFIX + 'D', + PageUp = ANSI_PREFIX + '5~', + PageDown = ANSI_PREFIX + '6~', + + // These keys have several possible escape sequences Home = 'LineHome', End = 'LineEnd', } @@ -30,10 +32,10 @@ export const Ansi = { row++; col++; - return `\x1b[${row};${col}H`; + return ANSI_PREFIX + `${row};${col}H`; }, - moveCursorForward: (col: number): string => `${ANSI_PREFIX}${col}C`, - moveCursorDown: (row: number): string => `${ANSI_PREFIX}${row}B`, + moveCursorForward: (col: number): string => ANSI_PREFIX + `${col}C`, + moveCursorDown: (row: number): string => ANSI_PREFIX + `${row}B`, }; export default Ansi;