-module(etch@erlang@tty). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/etch/erlang/tty.gleam"). -export([enter_raw/0, exit_raw/0, is_raw_mode/0, window_size/0]). -export_type([terminal_error/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. -type terminal_error() :: could_not_get_window_size | failed_to_enter_raw_mode | failed_to_exit_raw_mode. -file("src/etch/erlang/tty.gleam", 18). ?DOC( " Enters raw mode.\n" "\n" " Raw mode is a mode where the terminal does not process input, but instead\n" " passes it directly to the application. This means that:\n" " - Input is not echoed to the screen\n" " - Input is not line-buffered (characters are available immediately)\n" " - Some special characters are not processed by the terminal\n" "\n" " This is necessary for terminal UI applications that need to handle\n" " keyboard input and mouse events directly.\n" ). -spec enter_raw() -> {ok, nil} | {error, terminal_error()}. enter_raw() -> terminal_ffi:enter_raw(). -file("src/etch/erlang/tty.gleam", 28). ?DOC( " Exits raw mode.\n" "\n" " Raw mode is a mode where the terminal does not process input, but instead\n" " passes it directly to the application. This means that:\n" " - Input is not echoed to the screen\n" " - Input is not line-buffered (characters are available immediately)\n" " - Some special characters are not processed by the terminal\n" ). -spec exit_raw() -> {ok, nil} | {error, terminal_error()}. exit_raw() -> terminal_ffi:exit_raw(). -file("src/etch/erlang/tty.gleam", 31). -spec is_raw_mode() -> boolean(). is_raw_mode() -> tty_state:is_raw_mode(). -file("src/etch/erlang/tty.gleam", 35). ?DOC(" Returns current window size.\n"). -spec window_size() -> {ok, {integer(), integer()}} | {error, terminal_error()}. window_size() -> terminal_ffi:window_size().