Documentation

TermColor.Terminal.Basic

TermColor.Terminal.Basic: terminal control and IO #

The sequence builders are pure values. The IO helpers write to stdout and flush explicitly. Cursor controls are disabled for redirected output and TERM=dumb/TERM=unknown; live objects fall back to newline-separated snapshots in that mode. Live-region width follows the terminal on each default-width update; callers can pin it with updateTextAtWidth. Size detection is best effort: it queries /dev/tty for the current TTY size, then falls back to COLUMNS/LINES.

Move the cursor up by count rows, or emit nothing for zero.

Equations
Instances For

    Move the cursor down by count rows, or emit nothing for zero.

    Equations
    Instances For

      Move to a one-based terminal column.

      Equations
      Instances For

        Erase the current line and return to its first column.

        Equations
        Instances For

          Clear the visible screen and move the cursor to its home position.

          Equations
          Instances For

            Restore the previously saved cursor position.

            Equations
            Instances For

              Whether a TTY and terminal declaration allow cursor-control sequences.

              Equations
              Instances For

                Write text to stdout without flushing.

                Equations
                Instances For

                  Flush stdout.

                  Equations
                  Instances For

                    Render styled text using terminal detection and write it without a newline.

                    Equations
                    Instances For

                      Render styled text using terminal detection and write it with a newline.

                      Equations
                      Instances For

                        Move the cursor up and flush stdout.

                        Equations
                        Instances For

                          Move to a one-based terminal column and flush stdout.

                          Equations
                          Instances For

                            Whether stdout is attached to a terminal.

                            Equations
                            Instances For

                              Whether stdout is a TTY suitable for cursor-control sequences.

                              Equations
                              Instances For

                                Whether stdin is attached to a terminal.

                                Equations
                                Instances For

                                  A terminal's usable character dimensions.

                                  Instances For
                                    Equations
                                    Instances For
                                      Equations
                                      Instances For
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For

                                          Parse the rows columns output convention used by stty size.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For

                                            Query terminal dimensions, returning none when no size can be determined.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For

                                              Query terminal width, falling back to the layout library's default width.

                                              Equations
                                              Instances For

                                                A stable application-owned rectangle in one-based terminal coordinates.

                                                Instances For
                                                  Equations
                                                  Instances For
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For

                                                        Whether a one-based terminal coordinate lies inside a hit region.

                                                        Equations
                                                        Instances For

                                                          A pure frame supplied to Screen.renderFrame.

                                                          Instances For
                                                            Equations
                                                            Instances For
                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For

                                                                  Retained line-oriented screen state for small full-screen applications.

                                                                  Instances For

                                                                    Empty screen state, useful when testing diffSequence without terminal IO.

                                                                    Equations
                                                                    Instances For

                                                                      Start a screen and capture the current terminal size.

                                                                      Equations
                                                                      Instances For

                                                                        Pure line-granularity diff from the previous screen to next.

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For

                                                                          Render a frame, atomically retaining its hit regions after the write succeeds.

                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For

                                                                            Render a screen, rewriting only lines whose visible text changed.

                                                                            Equations
                                                                            Instances For

                                                                              Finish a screen and leave the cursor below its last rendered line.

                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              Instances For

                                                                                Enable SGR mouse events, optionally including drag reporting.

                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For

                                                                                  Enable mouse reporting when stdout is a capable terminal.

                                                                                  Equations
                                                                                  Instances For
                                                                                    def TermColor.Terminal.withMouseCapture {α : Type} (action : IO α) (drag : Bool := false) :
                                                                                    IO α

                                                                                    Scope mouse reporting and restore the terminal mode even when the action fails.

                                                                                    Equations
                                                                                    Instances For

                                                                                      State for redrawing a multi-line terminal region in place.

                                                                                      Instances For

                                                                                        Start an inactive live region.

                                                                                        Equations
                                                                                        Instances For

                                                                                          Use a supplied width for subsequent text updates.

                                                                                          Equations
                                                                                          Instances For

                                                                                            Pure output and next state for a multi-line redraw.

                                                                                            Equations
                                                                                            • One or more equations did not get rendered due to their size.
                                                                                            Instances For

                                                                                              Pure output and next state for finishing a live region.

                                                                                              Equations
                                                                                              Instances For

                                                                                                Redraw a multi-line region and flush stdout.

                                                                                                Equations
                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                Instances For

                                                                                                  Render styled text at a supplied width, redraw a multi-line region, and flush stdout.

                                                                                                  Equations
                                                                                                  Instances For

                                                                                                    Render styled text at the current terminal width, redraw the region, and flush stdout.

                                                                                                    When the region has no explicit width, the terminal is queried for every update so live output can reflow after a window resize.

                                                                                                    Equations
                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                    Instances For

                                                                                                      Leave the live region in place and move to the next line.

                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        def TermColor.Terminal.withHiddenCursor {α : Type} (action : IO α) :
                                                                                                        IO α

                                                                                                        Hide the cursor for an action and restore it even when the action fails.

                                                                                                        Equations
                                                                                                        Instances For
                                                                                                          def TermColor.Terminal.withAlternateScreen {α : Type} (action : IO α) :
                                                                                                          IO α

                                                                                                          Run an action in the alternate screen buffer and restore the normal screen afterward.

                                                                                                          Equations
                                                                                                          Instances For