propensive / escapade Goto Github PK
View Code? Open in Web Editor NEWAdventures in ANSI escape codes in Scala
Home Page: https://propensive.com/escapade/
License: Apache License 2.0
Adventures in ANSI escape codes in Scala
Home Page: https://propensive.com/escapade/
License: Apache License 2.0
If a string contains a URL link, its length is miscalculated. This may require an additional field to hold the link.
Escapes such as \n
and \t
are treated as literals inside ansi""
interpolated strings. The workaround is to embed a character (e.g. ansi"${'\n'}"
, but it's a lot of ceremony and is easily forgotten. There's code in Gossamer to expand standard escaped characters.
It's too confusing having both output and display/Displayable
terminology.
Escapes are currently represented as a pair of objects, a "push" and a "pop", which add and then remove a style from the text. These are stored independently, which does not make so much sense as storing each pair as a single "range" object.
Amongst other problems, the documentation still refers to the interpolator as ansi""
rather than e""
.
The way ANSI strings are rendered is not tested, except by looking at them to see if they seem right. It seems to work, but complex combinations of escapes are rarely used in practice, and any tests usually require a user to visually check that the text is rendered correctly in a terminal (and also to know what the correct rendering should look like).
A zero-length range, e.g. out"$Red(${t""})"
should not emit any escape codes, since doing so may cause unreliable rendering. In particular, they can clobber subsequent escapes.
The $TTY
environment variable should contain enough information to determine whether the current terminal supports all or any Escapade's output features, notably color. This environment could be provided through a context value in print
methods.
Escapade assumes that every character is rendered as a single "cell" in the terminal, however zero-width spaces and double-width characters may deviate from this assumption, and there's currently no way to know the rendered width, even though this would be useful for Escritoire.
Standard Java functions don't seem to exist for determining the render width from a character (and it might be font-dependent and terminal dependant—this should be checked). One possible way to work it out would be to attempt to render each and every character in the terminal, checking the cursor position before and after rendering. This "profile" could then be saved... but more likely it's standard anyway.
This should be used, if available, when converting from a Show[T]
to an AnsiShow[T]
to apply some style to the text.
The combination of foreground/background color, bold, underline, italic, etc, could all be represented with a single Long
which would be much faster than the current implementation using object copying.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.