EscHelpers

object EscHelpers
class Object
trait Matchable
class Any

Value members

Concrete methods

def cursorPosition(s: String): Int
def hasEscapeSequence(s: String): Boolean

Returns true if the string contains the ESC character.

Returns true if the string contains the ESC character.

TODO - this should handle raw CSI (not used much)

def removeEscapeSequences(s: String): String

Returns the string s with escape sequences removed. An escape sequence starts with the ESC character (decimal value 27) and ends with an escape terminator.

Returns the string s with escape sequences removed. An escape sequence starts with the ESC character (decimal value 27) and ends with an escape terminator.

See also:

isEscapeTerminator

def strip(bytes: Array[Byte], stripAnsi: Boolean, stripColor: Boolean): (Array[Byte], Int)

Strips ansi escape and color codes from an input string.

Strips ansi escape and color codes from an input string.

Value parameters:
bytes

the input bytes

stripAnsi

toggles whether or not to remove general ansi escape codes

stripColor

toggles whether or not to remove ansi color codes

Returns:

a string with the escape and color codes removed depending on the input parameter along with the length of the output string (which may be smaller than the returned array)

def stripColorsAndMoves(s: String): String

Removes the ansi escape sequences from a string and makes a best attempt at calculating any ansi moves by hand. For example, if the string contains a backspace character followed by a character, the output string would replace the character preceding the backspaces with the character proceding it. This is in contrast to strip which just removes all ansi codes entirely.

Removes the ansi escape sequences from a string and makes a best attempt at calculating any ansi moves by hand. For example, if the string contains a backspace character followed by a character, the output string would replace the character preceding the backspaces with the character proceding it. This is in contrast to strip which just removes all ansi codes entirely.

Value parameters:
s

the input string

Returns:

a string containing the original characters of the input stream with the ansi escape codes removed.

Deprecated methods

@deprecated("use EscHelpers.strip", "1.4.2")
def stripMoves(s: String): String
Deprecated

Concrete fields

final val ESC: '\u001b'

Escape character, used to introduce an escape sequence.

Escape character, used to introduce an escape sequence.