class RatatuiRuby::Widgets::Clear
Resets the terminal buffer for a specific area.
Painting in a terminal is additive. New content draws over old content. If the new content has transparency or empty spaces, the old content “bleeds” through. This ruins popups and modals.
This widget wipes the slate clean. It resets all cells in its area to their default state (spaces with default background).
Use it as the first layer in an Overlay stack when building popups. Ensure your floating windows are truly opaque.
Examples
# Opaque Popup Construction Overlay.new( layers: [ MainUI.new, Center.new( child: Overlay.new( layers: [ Clear.new, # Wipe the area first Block.new(title: "Modal", borders: [:all]) ] ), width_percent: 50, height_percent: 50 ) ] ) # Shortcut: rendering a block directly Clear.new(block: Block.new(title: "Cleared area", borders: [:all]))
Attributes
Public Class Methods
Source
# File lib/ratatui_ruby/widgets/clear.rb, line 61 def initialize(block: nil) super end