Git Product home page Git Product logo

escapade's Issues

Character escapes do not work in `ansi""` strings

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.

Define escapes as ranges instead of push/pop

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.

Update documentation

Amongst other problems, the documentation still refers to the interpolator as ansi"" rather than e"".

Find a good way to test rendering

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).

Zero-length ranges should not add escapes

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.

Use TTY environment variable to decide on rendering

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.

Investigate character widths

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.

Use an opaque type (`Long`) to represent style

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.