• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Printing messages
          • print_message/2
          • print_message_lines/3
          • message_hook/3
          • thread_message_hook/3
          • message_action/2
          • message_property/2
          • message_line_element/2
          • message_prefix_hook/2
          • message_to_string/2
          • version/0
          • version/1
          • Printing from libraries
    • Packages
Source[semidet,multifile]prolog:message_line_element(+Stream, +Term)
Hook implementation that colours the message elements produced by print_message_lines/3. Handled elements are:
ansi(Class, Fmt, Args)
ansi(Class, Fmt, Args, Ctx)
Write Fmt/Args using the attributes of Class. As the element ends with a full reset, the 4th argument version re-installs the decoration of the message as a whole afterwards.
url(Location)
url(URL, Label)
Write a hyperlink. See ansi_hyperlink/2,3. Label is an atom or string, a Format-Args pair or an ansi/3 or ansi/4 term. The latter combines a hyperlink with a style class.
begin(Class, Ctx)
end(Ctx)
Decorate the message as a whole. See below.
nl(Ctx), flush(Ctx)
End a line. If the message has a background colour, the remainder of the line is painted using ‘\e[K` (Erase in Line) such that the coloured block extends to the right margin.
eol(Ctx)
As above, but also reset the attributes: this ends the decorated part of the line. A message uses this for its last line if that line is not ended using nl. Resetting matters because a terminal that scrolls while a background colour is in effect paints the newly exposed line with it.

Ctx is the message context. It is created by the handler for begin/2 as a term

ansi(Reset, ReInstall, EraseEol)

where Reset is the sequence written by end/1, ReInstall is a Format-Args pair that re-installs the attributes of the message and EraseEol is the sequence that paints the remainder of the line or the empty atom. Callers must treat Ctx as opaque. It is left unbound if Stream is not a terminal, if the color_term flag is false or if the message has no attributes. All handlers that use Ctx therefore fail if it is unbound, which makes print_message_lines/3 fall back to writing plain text.

Sourceprolog:message_line_element(+Stream, +Term)
This hook is called to print the individual elements of a message from print_message_lines/3. This hook is used by e.g., library library(ansi_term) to colour messages on ANSI-capable terminals. If it fails, print_message_lines/3 prints Term itself, ignoring any decoration. Note that the elements that carry the context established by begin(Class, Context) are passed to this hook in their long form, e.g., nl(Context) rather than nl. See print_message_lines/3 for the details.
ClioPatria (version V3.1.1-59-g7b9a7a3)