From 85f520041046be2a184af31bff8a1d7ca0027f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 29 Sep 2023 23:19:43 +0200 Subject: ColorizedString : add CLEAR_LINE --- lib/colonial_twilight/colorized_string.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/colonial_twilight/colorized_string.rb b/lib/colonial_twilight/colorized_string.rb index db13bbd..2a63852 100644 --- a/lib/colonial_twilight/colorized_string.rb +++ b/lib/colonial_twilight/colorized_string.rb @@ -3,7 +3,10 @@ # this adds ascii colorization to String class class String + RESET = "\033[0m" + CLEAR_LINE = "\33[2K\r" CLS = "\033[0;0f\033\[2J" + @color_codes = { black: 0, light_black: 60, red: 1, light_red: 61, @@ -58,7 +61,6 @@ class String private - RESET = "\033[0m" START_CODE = /^\033\[([0-9;]+)m/.freeze # negative lookbehind : (? is not at the start of the line # negative lookahead : (?! ) + $ => is not at the end of the line -- cgit v1.1-2-g2b99