Liking cljdoc? Tell your friends :D

lanterna.terminal


add-resize-listenerclj

(add-resize-listener terminal listener-fn)

Create a listener that will call the supplied fn when the terminal is resized.

The function must take two arguments: the new number of columns and the new number of rows.

The listener itself will be returned. You don't need to do anything with it, but you can use it to remove it later with remove-resize-listener.

Create a listener that will call the supplied fn when the terminal is resized.

The function must take two arguments: the new number of columns and the new
number of rows.

The listener itself will be returned.  You don't need to do anything with it,
but you can use it to remove it later with remove-resize-listener.

sourceraw docstring

clearclj

(clear terminal)

Clear the terminal.

The cursor will be at 0 0 afterwards.

Clear the terminal.

The cursor will be at 0 0 afterwards.

sourceraw docstring

get-available-fontsclj

(get-available-fonts)
source

get-keyclj

(get-key terminal)

Get the next keypress from the user, or nil if none are buffered.

If the user has pressed a key, that key will be returned (and popped off the buffer of input).

If the user has not pressed a key, nil will be returned immediately. If you want to wait for user input, use get-key-blocking instead.

Get the next keypress from the user, or nil if none are buffered.

If the user has pressed a key, that key will be returned (and popped off the
buffer of input).

If the user has *not* pressed a key, nil will be returned immediately.  If you
want to wait for user input, use get-key-blocking instead.

sourceraw docstring

get-key-blockingclj

(get-key-blocking terminal)
(get-key-blocking terminal {:keys [interval timeout] :as opts})

Get the next keypress from the user.

If the user has pressed a key, that key will be returned (and popped off the buffer of input).

If the user has not pressed a key, this function will block, checking every 50ms. If you want to return nil immediately, use get-key instead.

Options can include any of the following keys:

:interval - sets the interval between checks :timeout - sets the maximum amount of time blocking will occur before returning nil

Get the next keypress from the user.

If the user has pressed a key, that key will be returned (and popped off the
buffer of input).

If the user has *not* pressed a key, this function will block, checking every
50ms.  If you want to return nil immediately, use get-key instead.

Options can include any of the following keys:

:interval - sets the interval between checks
:timeout  - sets the maximum amount of time blocking will occur before
            returning nil

sourceraw docstring

get-sizeclj

(get-size terminal)

Return the current size of the terminal as [cols rows].

Return the current size of the terminal as [cols rows].
sourceraw docstring

get-terminalclj

(get-terminal)
(get-terminal kind)
(get-terminal kind
              {:as opts
               :keys [cols rows charset resize-listener]
               :or {cols 80 rows 24 charset :utf-8 resize-listener nil}})

Get a terminal object.

kind can be one of the following:

:auto - Try to guess the right type of terminal based on OS, whether there's a windowing environment, etc :swing - Force a Swing-based terminal. :text - Force a console (i.e.: non-Swing) terminal. Try to guess the appropriate kind of console (UNIX/Cygwin) by the OS. :unix - Force a UNIX console terminal. :cygwin - Force a Cygwin console terminal.

Options can contain one or more of the following keys:

:cols - Width of the desired terminal in characters (default 80). :rows - Height of the desired terminal in characters (default 24). :charset - Charset of the desired terminal. Can be any of (keys lanterna.constants/charsets) (default :utf-8). :resize-listener - A function to call when the terminal is resized. This function should take two parameters: the new number of columns, and the new number of rows. :font - Font to use. String or sequence of strings. Use (lanterna.terminal/get-available-fonts) to see your options. Will fall back to a basic monospaced font if none of the given names are available. :font-size - Font size (default 14). :palette - Color palette to use. Can be any of (keys lanterna.constants/palettes) (default :mac-os-x).

NOTE: The options are really just a suggestion!

The console terminal will ignore rows and columns and fonts and colors.

The Swing terminal will start out at this size but can be resized later by the user, and will ignore the charset entirely.

God only know what Cygwin will do.

Get a terminal object.

kind can be one of the following:

:auto   - Try to guess the right type of terminal based on OS, whether
          there's a windowing environment, etc
:swing  - Force a Swing-based terminal.
:text   - Force a console (i.e.: non-Swing) terminal.  Try to guess the
          appropriate kind of console (UNIX/Cygwin) by the OS.
:unix   - Force a UNIX console terminal.
:cygwin - Force a Cygwin console terminal.

Options can contain one or more of the following keys:

:cols    - Width of the desired terminal in characters (default 80).
:rows    - Height of the desired terminal in characters (default 24).
:charset - Charset of the desired terminal.  Can be any of
           (keys lanterna.constants/charsets) (default :utf-8).
:resize-listener - A function to call when the terminal is resized.  This
                   function should take two parameters: the new number of
                   columns, and the new number of rows.
:font      - Font to use.  String or sequence of strings.
             Use (lanterna.terminal/get-available-fonts) to see your options.
             Will fall back to a basic monospaced font if none of the given
             names are available.
:font-size - Font size (default 14).
:palette   - Color palette to use. Can be any of
             (keys lanterna.constants/palettes) (default :mac-os-x).

NOTE: The options are really just a suggestion!

The console terminal will ignore rows and columns and fonts and colors.

The Swing terminal will start out at this size but can be resized later by the
user, and will ignore the charset entirely.

God only know what Cygwin will do.

sourceraw docstring

in-terminalcljmacro

(in-terminal terminal & body)

Start the given terminal, perform the body, and stop the terminal afterward.

Start the given terminal, perform the body, and stop the terminal afterward.
sourceraw docstring

move-cursorclj

(move-cursor terminal x y)

Move the cursor to a specific location on the screen.

Move the cursor to a specific location on the screen.
sourceraw docstring

put-characterclj

(put-character terminal ch)
(put-character terminal ch x y)

Draw the character at the current cursor location.

If x and y are given, moves the cursor there first.

Moves the cursor one character to the right, so a sequence of calls will output next to each other.

Draw the character at the current cursor location.

If x and y are given, moves the cursor there first.

Moves the cursor one character to the right, so a sequence of calls will
output next to each other.

sourceraw docstring

put-stringclj

(put-string terminal s)
(put-string terminal s x y)

Draw the string at the current cursor location.

If x and y are given, moves the cursor there first.

The cursor will end up at the position directly after the string.

Draw the string at the current cursor location.

If x and y are given, moves the cursor there first.

The cursor will end up at the position directly after the string.

sourceraw docstring

remove-resize-listenerclj

(remove-resize-listener terminal listener)

Remove a resize listener from the given terminal.

Remove a resize listener from the given terminal.
sourceraw docstring

remove-styleclj

(remove-style terminal style)

Exit a style

Exit a style
sourceraw docstring

reset-stylesclj

(reset-styles terminal)

Reset all styles

Reset all styles
sourceraw docstring

set-bg-colorclj

(set-bg-color terminal color)
source

set-fg-colorclj

(set-fg-color terminal color)
source

set-styleclj

(set-style terminal style)

Enter a style

Enter a style
sourceraw docstring

startclj

(start terminal)

Start the terminal. Consider using in-terminal instead.

Start the terminal.  Consider using in-terminal instead.
sourceraw docstring

stopclj

(stop terminal)

Stop the terminal. Consider using in-terminal instead.

Stop the terminal.  Consider using in-terminal instead.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close