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
*/
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;