CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-asciimatics

tessl install tessl/pypi-asciimatics@1.15.0

A cross-platform package to replace curses (mouse/keyboard input & text colours/positioning) and create ASCII animations

Agent Success

Agent success rate when using this tile

81%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.33x

Baseline

Agent success rate without this tile

61%

task.mdevals/scenario-10/

Terminal Message Logger

Create a simple terminal-based message logger that displays log messages with automatic scrolling when the screen fills up. The logger should support clearing the screen and maintaining a scrollable view of messages.

Requirements

Your implementation should create a message logger that:

  1. Displays messages on the terminal screen starting from the top
  2. Automatically scrolls the screen upward when new messages are added and the screen is full
  3. Provides a command to clear all messages from the screen
  4. Updates the display properly after each operation

The logger should accept the following commands:

  • log <message>: Add a new message to the screen. If the screen is full, scroll to make room.
  • clear: Clear all messages from the screen
  • quit: Exit the program

Implementation Details

  • Messages should be displayed starting at line 1 of the screen
  • Each message should be on its own line
  • When the screen reaches capacity (height - 2 lines to leave room for input), the next message should cause the screen to scroll up by one line
  • After clearing, the next message should start again from the top
  • The program should show a simple prompt at the bottom: Command:
  • Use double-buffered rendering to avoid flicker

Test Cases

  • Logging a single message "Hello" displays it at the top of the screen @test
  • Logging multiple messages displays them sequentially line by line @test
  • When messages exceed screen height minus 2, the screen scrolls upward and the new message appears at the bottom of the message area @test
  • Executing the clear command removes all messages from the screen @test

Implementation

@generates

API

class MessageLogger:
    """
    A terminal-based message logger with automatic scrolling and clearing.
    """

    def __init__(self, screen):
        """
        Initialize the message logger.

        Args:
            screen: The Screen object for terminal control
        """
        pass

    def log_message(self, message):
        """
        Add a message to the logger display.
        Automatically scrolls if screen is full.

        Args:
            message: String message to display
        """
        pass

    def clear_messages(self):
        """
        Clear all messages from the screen.
        """
        pass

    def display(self):
        """
        Render the current state to the screen.
        """
        pass

    def run(self):
        """
        Run the interactive message logger.
        Accepts commands: log <message>, clear, quit
        """
        pass

Dependencies { .dependencies }

asciimatics { .dependency }

Provides terminal control with screen clearing, scrolling, and rendering support.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/asciimatics@1.15.x
tile.json