Raxol.Terminal.Cursor.Style (Raxol v0.4.0)

View Source

Handles cursor style and visibility control for the terminal emulator.

This module provides functions for changing cursor appearance, controlling visibility, and managing cursor blinking.

Summary

Functions

Makes the cursor blink.

Hides the cursor.

Sets the cursor style to bar.

Sets the cursor blink rate in milliseconds.

Sets the cursor style to block.

Sets a custom cursor shape.

Sets the cursor style to underline.

Makes the cursor visible.

Toggles the cursor blinking state.

Toggles the cursor visibility.

Updates the cursor blink state and returns the updated cursor and visibility.

Functions

blink(cursor)

Makes the cursor blink.

Examples

iex> alias Raxol.Terminal.Cursor.{Manager, Style}
iex> cursor = Manager.new()
iex> cursor = Style.blink(cursor)
iex> cursor.state
:blinking

hide(cursor)

Hides the cursor.

Examples

iex> alias Raxol.Terminal.Cursor.{Manager, Style}
iex> cursor = Manager.new()
iex> cursor = Style.hide(cursor)
iex> cursor.state
:hidden

set_bar(cursor)

Sets the cursor style to bar.

Examples

iex> alias Raxol.Terminal.Cursor.{Manager, Style}
iex> cursor = Manager.new()
iex> cursor = Style.set_bar(cursor)
iex> cursor.style
:bar

set_block(cursor)

Sets the cursor style to block.

Examples

iex> alias Raxol.Terminal.Cursor.{Manager, Style}
iex> cursor = Manager.new()
iex> cursor = Style.set_block(cursor)
iex> cursor.style
:block

set_custom(cursor, shape, dimensions)

Sets a custom cursor shape.

Examples

iex> alias Raxol.Terminal.Cursor.{Manager, Style}
iex> cursor = Manager.new()
iex> cursor = Style.set_custom(cursor, "█", {2, 1})
iex> cursor.style
:custom
iex> cursor.custom_shape
"█"

set_underline(cursor)

Sets the cursor style to underline.

Examples

iex> alias Raxol.Terminal.Cursor.{Manager, Style}
iex> cursor = Manager.new()
iex> cursor = Style.set_underline(cursor)
iex> cursor.style
:underline

show(cursor)

Makes the cursor visible.

Examples

iex> alias Raxol.Terminal.Cursor.{Manager, Style}
iex> cursor = Manager.new()
iex> cursor = Manager.set_state(cursor, :hidden)
iex> cursor = Style.show(cursor)
iex> cursor.state
:visible

toggle_blink(cursor)

Toggles the cursor blinking state.

Examples

iex> alias Raxol.Terminal.Cursor.{Manager, Style}
iex> cursor = Manager.new()
iex> cursor = Style.toggle_blink(cursor)
iex> cursor.state
:blinking
iex> cursor = Style.toggle_blink(cursor)
iex> cursor.state
:visible

toggle_visibility(cursor)

Toggles the cursor visibility.

Examples

iex> alias Raxol.Terminal.Cursor.{Manager, Style}
iex> cursor = Manager.new()
iex> cursor = Style.toggle_visibility(cursor)
iex> cursor.state
:hidden
iex> cursor = Style.toggle_visibility(cursor)
iex> cursor.state
:visible

update_blink(cursor)

Updates the cursor blink state and returns the updated cursor and visibility.

Examples

iex> alias Raxol.Terminal.Cursor.{Manager, Style}
iex> cursor = Manager.new()
iex> cursor = Style.blink(cursor)
iex> {cursor, visible} = Style.update_blink(cursor)
iex> is_boolean(visible)
true