module

TermBuf::CapabilityResolver

Stability: internal

Settles what the terminal can do, in four stages, each overriding the one before it:

  1. a baseline of nothing at all;
  2. what the environment suggests;
  3. what the terminal says when asked directly;
  4. whatever TERMBUF_CAPS insists on.

Stage 3 is not quite unconditional: under a multiplexer a mode report can be the multiplexer's own answer for a mode it never forwards, and those modes are named by EnvironmentDetector.distrusted and handed to the probe, which then adds nothing for them.

Probing is skipped when there is nothing to probe — output that is not a terminal, or a caller that did not supply one. That is not an error: the environment heuristics stand on their own, and a program writing to a pipe still needs a capability set.

Instance methods

resolve(env : Hash(String, String) = ENV.to_h, input : IO | Nil = nil, output : IO | Nil = nil, timeout : Time::Span = Prober::DEFAULT_TIMEOUT) : Result

Runs the four stages. Probes only when both input and output are given.

Source

Nested types