From d2a6c480a7d7203b372263173500db9cd9cfff55 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Tue, 30 Mar 2021 21:22:28 -0400 Subject: [PATCH] Cut down on repetition with ansi constants --- terminal/ansi.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/terminal/ansi.go b/terminal/ansi.go index 35246ac..5f88f70 100644 --- a/terminal/ansi.go +++ b/terminal/ansi.go @@ -12,22 +12,22 @@ const EscPrefix = "\x1b[" const ( // Clears the line after the escape sequence - ClearLine = "\x1b[K" + ClearLine = EscPrefix + "K" // Clears the entire screen - ClearScreen = "\x1b[2J" + ClearScreen = EscPrefix + "2J" ) // Cursor Codes const ( - HideCursor = "\x1b[?25l" - ShowCursor = "\x1b[?25h" + HideCursor = EscPrefix + "?25l" + ShowCursor = EscPrefix + "?25h" // Reports cursor location to stdout - LocateCursor = "\x1b[6n" + LocateCursor = EscPrefix + "6n" // Moves cursor to default position (1,1) - ResetCursor = "\x1b[H" + ResetCursor = EscPrefix + "H" ) // ----------------------------------------------------------------------------