Skip to content

Tmux Glitches #3840

@PraaneshSelvaraj

Description

@PraaneshSelvaraj

Hey everyone, I've got this weird issue where my Python scripts look all glitchy when I run them inside a Tmux session. The panels, especially for borderss, get totally messed up. The exact same script runs perfectly fine in a normal terminal. No glitches, no broken lines, everything looks clean.

Screenshots:

  • This is how it should look (in a normal terminal):
Image
  • And this is the glitchI get in Tmux:
Image

CODE:

#!/usr/bin/env python3

import time
from rich.console import Console
from rich.panel import Panel
from rich.text import Text
from rich.live import Live

console = Console()

def test_borders():
    """Test different border styles in tmux"""
    
    # Test 1: Basic Panel
    test1 = Panel("Basic Panel Test", title="Test 1", border_style="green")
    
    # Test 2: Panel with content
    content = Text()
    content.append("This is a test\n", style="white")
    content.append("Multiple lines\n", style="cyan")
    content.append("In a panel", style="yellow")
    test2 = Panel(content, title="Test 2 - Content", border_style="blue")
    
    # Test 3: Different border styles
    test3 = Panel("ASCII Border", title="Test 3", border_style="red")
    test4 = Panel("Thick Border", title="Test 4", border_style="magenta", style="bold")
    
    # Test 5: No border
    test5 = Panel("No Border", title="Test 5", border_style="none")
    
    # Print all tests
    console.print("=== TMUX BORDER TESTS ===\n")
    console.print(test1)
    console.print()
    console.print(test2)
    console.print()
    console.print(test3)
    console.print()
    console.print(test4)
    console.print()
    console.print(test5)
    console.print()
    console.print("Press Ctrl+C to exit...")

def test_live_borders():
    """Test borders with Live updates"""
    counter = 0
    
    try:
        with Live(screen=False) as live:
            while True:
                content = Text()
                content.append(f"Counter: {counter}\n", style="white")
                content.append(f"Time: {time.strftime('%H:%M:%S')}", style="dim")
                
                panel = Panel(
                    content,
                    title=f"[bold green]Live Test {counter}[/bold green]",
                    border_style="green"
                )
                
                live.update(panel)
                time.sleep(1)
                counter += 1
                
    except KeyboardInterrupt:
        console.print("\n[red]Live test stopped[/red]")

if __name__ == "__main__":
    import sys
    
    if len(sys.argv) > 1 and sys.argv[1] == "live":
        test_live_borders()
    else:
        test_borders()
        print("\nRun with 'live' argument to test Live updates:")
        print("python3 border_test.py live")

**Steps to Reproduce: **

  1. Open up Tmux.
  2. Run the Python script
  3. Watch the borders get all glitchy.

My setup

  • OS: Debian 13
  • Tmux Version: tmux 3.5a
  • Python Version: Python 3.13.5
  • Rich Version: 14.1.0

Any ideas on what could be causing this? Thanks for any help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions