Minor reformatting tweak

This commit is contained in:
Timothy Warren 2023-11-10 19:40:05 -05:00
parent 3f1326ebd0
commit 8bb3018e84

View File

@ -8,12 +8,14 @@ function esc(pieces: TemplateStringsArray): string {
* ANSI escapes for various inputs * ANSI escapes for various inputs
*/ */
export enum KeyCommand { export enum KeyCommand {
ArrowUp = `${ANSI_PREFIX}A`, ArrowUp = ANSI_PREFIX + 'A',
ArrowDown = `${ANSI_PREFIX}B`, ArrowDown = ANSI_PREFIX + 'B',
ArrowRight = `${ANSI_PREFIX}C`, ArrowRight = ANSI_PREFIX + 'C',
ArrowLeft = `${ANSI_PREFIX}D`, ArrowLeft = ANSI_PREFIX + 'D',
PageUp = `${ANSI_PREFIX}5~`, PageUp = ANSI_PREFIX + '5~',
PageDown = `${ANSI_PREFIX}6~`, PageDown = ANSI_PREFIX + '6~',
// These keys have several possible escape sequences
Home = 'LineHome', Home = 'LineHome',
End = 'LineEnd', End = 'LineEnd',
} }
@ -30,10 +32,10 @@ export const Ansi = {
row++; row++;
col++; col++;
return `\x1b[${row};${col}H`; return ANSI_PREFIX + `${row};${col}H`;
}, },
moveCursorForward: (col: number): string => `${ANSI_PREFIX}${col}C`, moveCursorForward: (col: number): string => ANSI_PREFIX + `${col}C`,
moveCursorDown: (row: number): string => `${ANSI_PREFIX}${row}B`, moveCursorDown: (row: number): string => ANSI_PREFIX + `${row}B`,
}; };
export default Ansi; export default Ansi;