Scoop API

scoop:scoop.terminal.asyncio:0.1.0

AsyncTerminalSession

class AsyncTerminalSession

source · line 15
public
public class AsyncTerminalSession private constructor(
    internal val tty: AsyncTty,
    private val loop: EventLoop,
    parser: InputParser
) : AsyncByteSink, AsyncCloseable

An event-loop-bound terminal session combining parsed input, terminal queries, raw-mode control, and asynchronous output. Operations require an active job on the owning loop; close the session after use.

Extensions

function enableRawMode

source · line 122
public
public suspend fun enableRawMode(): Unit

Enables raw terminal input while reserving session input and output access.

function isRawMode

source · line 113
public
public suspend fun isRawMode(): Boolean

Reads the actual terminal mode and refreshes the session's tracked raw-mode state.

function close

source · line 150
public
public override suspend fun close(): Unit

Closes the terminal handle and waits for active session operations to leave their access scopes. Repeated closes after cleanup return immediately.

function flush

source · line 142
public
public override suspend fun flush(): Unit

Waits for buffered terminal output to be flushed.

function size

source · line 105
public
public suspend fun size(): TerminalSize

Reads the terminal dimensions, including pixel dimensions when the host supplies them.

function poll

source · line 96
public
public suspend fun poll(timeout: Duration): Boolean

Waits up to a nonnegative timeout for a parsed input event without consuming the event. A zero timeout checks current availability.

function disableRawMode

source · line 129
public
public suspend fun disableRawMode(): Unit

Restores non-raw terminal input. Cleanup can call this even when the active job is cancelling.

function read

source · line 91
public
public suspend fun read(): Event

Waits for the next parsed keyboard, mouse, paste, focus, or resize event.