diff --git a/gohelper.go b/gohelper.go index d36a40b..1cbe698 100644 --- a/gohelper.go +++ b/gohelper.go @@ -6,22 +6,6 @@ import ( "os" ) -/* -RESET -RED -GREEN -YELLOW -BLUE -PURPLE -CYAN -WHITE -BGBLACK -BOLD -UNDERLINE -BLINK -CLEAR -LEFT -*/ const ( // ANSI color codes RESET = "\033[0m" @@ -37,7 +21,6 @@ const ( UNDERLINE = "\033[4m" BLINK = "\033[5m" CLEAR = "\033[2J\033[H" - LEFT = "\033[1000D" ) const ( @@ -113,27 +96,30 @@ func Cwindows() error { return nil } -/* - Up: \u001b[{n}A moves cursor up by n - Down: \u001b[{n}B moves cursor down by n - Right: \u001b[{n}C moves cursor right by n - Left: \u001b[{n}D moves cursor left by n +const ( + Up = "\u001b[{n}A" //moves cursor up by n + Down = "\u001b[{n}B" //moves cursor down by n + Right = "\u001b[{n}C" //moves cursor right by n + Left = "\u001b[{n}D" //moves cursor left by n + + NextLine = "\u001b[{n}E" //moves cursor to beginning of line n lines down + PrevLine = "\u001b[{n}F" //moves cursor to beginning of line n lines down - Next Line: \u001b[{n}E moves cursor to beginning of line n lines down - Prev Line: \u001b[{n}F moves cursor to beginning of line n lines down + SetColumn = "\u001b[{n}G" //moves cursor to column n + SetPosition = "\u001b[{n};{m}H" //moves cursor to row n column m - Set Column: \u001b[{n}G moves cursor to column n - Set Position: \u001b[{n};{m}H moves cursor to row n column m + ClearScreen = "\u001b[{n}J" + // clears the screen + // n=0 clears from cursor until end of screen, + // n=1 clears from cursor to beginning of screen + // n=2 clears entire screen - Clear Screen: \u001b[{n}J clears the screen - n=0 clears from cursor until end of screen, - n=1 clears from cursor to beginning of screen - n=2 clears entire screen - Clear Line: \u001b[{n}K clears the current line - n=0 clears from cursor to end of line - n=1 clears from cursor to start of line - n=2 clears entire line + ClearLine = "\u001b[{n}K" + // clears the current line + // n=0 clears from cursor to end of line + // n=1 clears from cursor to start of line + // n=2 clears entire line - Save Position: \u001b[{s} saves the current cursor position - Save Position: \u001b[{u} restores the cursor to the last saved position -*/ + SavePosition = "\u001b[s" //saves the current cursor position + RestorePosition = "\u001b[u" //restores the cursor to the last saved position +)