or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

advanced.mdcursor.mdindex.mdlines.mdscreen.md
tile.json

screen.mddocs/

Screen Management

Operations for managing terminal display, clearing screens, controlling screen buffers, scrolling, and audio feedback.

Capabilities

Screen Clearing

Clear the terminal screen and manage display state.

/**
 * Clear the terminal screen (viewport only)
 */
const clearScreen: string;

/**
 * Clear the whole terminal, including scrollback buffer
 */
const clearTerminal: string;

/**
 * Erase the screen and move cursor to top-left position
 */
const eraseScreen: string;

Usage Examples:

import { clearScreen, clearTerminal, eraseScreen } from 'ansi-escapes';

// Clear visible terminal screen
process.stdout.write(clearScreen);

// Clear terminal including scrollback history
process.stdout.write(clearTerminal);

// Erase screen and reset cursor position
process.stdout.write(eraseScreen);

Screen Buffer Management

Control alternative screen buffer for full-screen applications.

/**
 * Enter the alternative screen buffer
 */
const enterAlternativeScreen: string;

/**
 * Exit the alternative screen buffer, returning to main screen
 */
const exitAlternativeScreen: string;

Usage Examples:

import { enterAlternativeScreen, exitAlternativeScreen } from 'ansi-escapes';

// Enter alternative screen (like vim, less, etc.)
process.stdout.write(enterAlternativeScreen);

// ... run full-screen application ...

// Return to main screen, restoring previous content
process.stdout.write(exitAlternativeScreen);

The alternative screen buffer allows applications to use the full terminal without affecting the user's existing terminal content. When the application exits the alternative screen, the previous content is restored.

Scrolling Operations

Control terminal scrolling behavior.

/**
 * Scroll display up one line
 */
const scrollUp: string;

/**
 * Scroll display down one line
 */
const scrollDown: string;

Usage Examples:

import { scrollUp, scrollDown } from 'ansi-escapes';

// Scroll terminal content up by one line
process.stdout.write(scrollUp);

// Scroll terminal content down by one line
process.stdout.write(scrollDown);

Audio Feedback

Generate audio signals from the terminal.

/**
 * Output a beeping sound
 */
const beep: string;

Usage Examples:

import { beep } from 'ansi-escapes';

// Generate a system beep
process.stdout.write(beep);

// Use for alerts or notifications
if (errorOccurred) {
  process.stdout.write(beep);
  console.log('Error: Operation failed!');
}

Platform Considerations

The screen management operations handle cross-platform differences automatically:

  • Windows: Uses optimized clearing sequences for Windows Command Prompt and PowerShell
  • macOS Terminal: Uses Apple Terminal-specific optimizations where appropriate
  • Linux/Unix: Uses standard ANSI sequences compatible with most terminal emulators
  • Browser: Compatible with terminal emulators like Xterm.js

Cross-platform clearing example:

import { clearTerminal } from 'ansi-escapes';

// This works consistently across Windows, macOS, and Linux
function clearAndReset() {
  process.stdout.write(clearTerminal);
  console.log('Terminal cleared successfully!');
}