/usr/local/lib/swipl/library/ansi_term.pl
All Application Manual Name SummaryHelp

  • swipl
    • library
      • error.pl
      • debug.pl -- Print debug messages and test assertions
      • apply.pl -- Apply predicates on a list
      • lists.pl -- List Manipulation
      • broadcast.pl -- Event service
      • shlib.pl
      • option.pl -- Option list processing
      • thread_pool.pl -- Resource bounded thread management
      • gensym.pl -- Generate unique symbols
      • settings.pl
      • arithmetic.pl
      • main.pl -- Provide entry point for scripts
      • readutil.pl -- Read utilities
      • operators.pl
      • pairs.pl -- Operations on key-value lists
      • prolog_source.pl -- Examine Prolog source-files
      • record.pl -- Access compound arguments by name
      • predicate_options.pl -- Access and analyse predicate options
      • sandbox.pl
      • apply_macros.pl -- Goal expansion rules to avoid meta-calling
      • yall.pl -- Lambda expressions
      • assoc.pl
      • prolog_format.pl -- Analyse format specifications
      • quasi_quotations.pl
      • pure_input.pl -- Pure Input from files and streams
      • solution_sequences.pl -- Modify solution sequences
      • ordsets.pl -- Ordered set manipulation
      • random.pl -- Random numbers
      • base64.pl -- Base64 encoding and decoding
      • aggregate.pl -- Aggregation operators on backtrackable predicates
      • csv.pl
      • pprint.pl -- Pretty Print Prolog terms
      • atom.pl
      • modules.pl
      • occurs.pl -- Finding and counting sub-terms
      • prolog_xref.pl -- Prolog cross-referencer data collection
      • prolog_colour.pl -- Prolog syntax colouring support.
      • lazy_lists.pl
      • ugraphs.pl
      • url.pl
      • www_browser.pl
      • prolog_pack.pl
      • git.pl -- Run GIT commands
      • rbtrees.pl -- Red black trees
      • dif.pl
      • charsio.pl
      • prolog_stack.pl -- Examine the Prolog stack
      • edinburgh.pl -- Some traditional Edinburgh predicates
      • prolog_clause.pl
      • prolog_breakpoints.pl
      • wfs.pl
      • dialect.pl
      • prolog_code.pl
      • sort.pl
      • iostream.pl -- Utilities to deal with streams
      • dicts.pl
      • varnumbers.pl
      • base32.pl -- Base32 encoding and decoding
      • codesio.pl
      • coinduction.pl -- Co-Logic Programming
      • date.pl -- Process dates and times
      • heaps.pl -- heaps/priority queues
      • statistics.pl
      • terms.pl -- Term manipulation
      • utf8.pl -- UTF-8 encoding/decoding on lists of character codes.
      • when.pl -- Conditional coroutining
      • backcomp.pl -- Backward compatibility
      • oset.pl
      • macros.pl
      • optparse.pl -- command line parsing
      • prolog_trace.pl
      • prolog_wrap.pl
      • prolog_metainference.pl -- Infer meta-predicate properties
      • shell.pl
      • persistency.pl
      • intercept.pl -- Intercept and signal interface
      • listing.pl -- List programs and pretty print clauses
      • strings.pl
      • quintus.pl
      • qsave.pl -- Save current program as a state or executable
      • zip.pl -- Access resource ZIP archives
      • portray_text.pl -- Portray text
      • thread.pl
      • make.pl
      • prolog_autoload.pl -- Autoload all dependencies
      • check.pl -- Consistency checking
      • prolog_coverage.pl -- Coverage analysis tool
      • hashtable.pl
      • ctypes.pl -- Character code classification
      • threadutil.pl -- Interactive thread utilities
      • ansi_term.pl -- Print decorated text to ANSI consoles
        • ansi_format/3
        • ansi_format/4
        • ansi_sgr/2
        • ansi_hyperlink/2
        • ansi_hyperlink/3
        • tty_url_hook/2
        • ansi_get_color/2
        • console_color/3
        • console_color/2
        • theme_base/2
        • message_line_element/2
      • prolog_debug.pl
      • writef.pl
      • prolog_versions.pl -- Demand specific (Prolog) versions
      • prolog_codewalk.pl
      • prolog_config.pl
      • explain.pl -- Describe Prolog Terms
      • files.pl
      • prolog_jiti.pl
      • prolog_history.pl
      • prolog_qlfmake.pl -- Compile the library to QLF format
      • nb_set.pl -- Non-backtrackable sets
      • increval.pl
      • tables.pl -- XSB interface to tables
      • streams.pl -- Manage Prolog streams
      • rwlocks.pl
      • edit.pl -- Editor interface
      • system.pl -- System utilities
      • prolog_profile.pl -- Execution profiler
 ansi_hyperlink(+Stream, +Location) is det
 ansi_hyperlink(+Stream, +Location, +Label) is det
Create a hyperlink for a terminal emulator using the OSC 8 escape sequence. Location is one of
  • An absolute URL
  • An atom (interpreted as a file name)
  • A term File:Line
  • A term File:Line:Column

There is no official standard for encoding the Line and Column. We emit

``file://AbsFileName[#Line[:Column]]``

Both Line and Column count from 1, as in the messages we print and as used by e.g., rg --hyperlink-format=.... Note that a capital L before the line, as used by GitHub, is accepted by Epilog as well.

The sequence is emitted if and only if the Prolog flag hyperlink_term is true and Stream has the property tty(true). ansi_format/4 is guarded the same way for color_term, so that a message captured using with_output_to/2 is plain text.

See also
- https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda