forked from genewildish/Mainline
feat(integration): Complete feature rewrite with pipeline architecture, effects system, and display improvements
Major changes: - Pipeline architecture with capability-based dependency resolution - Effects plugin system with performance monitoring - Display abstraction with multiple backends (terminal, null, websocket) - Camera system for viewport scrolling - Sensor framework for real-time input - Command-and-control system via ntfy - WebSocket display backend for browser clients - Comprehensive test suite and documentation Issue #48: ADR for preset scripting language included This commit consolidates 110 individual commits into a single feature integration that can be reviewed and tested before further refinement.
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
"""
|
||||
Visual effects: noise, glitch, fade, ANSI-aware truncation, firehose, headline pool.
|
||||
Depends on: config, terminal, sources.
|
||||
|
||||
These are low-level functional implementations of visual effects. They are used
|
||||
internally by the EffectPlugin system (effects_plugins/*.py) and also directly
|
||||
by layers.py and scroll.py for rendering.
|
||||
|
||||
The plugin system provides a higher-level OOP interface with configuration
|
||||
support, while these legacy functions provide direct functional access.
|
||||
Both systems coexist - there are no current plans to deprecate the legacy functions.
|
||||
"""
|
||||
|
||||
import random
|
||||
@@ -74,6 +82,37 @@ def vis_trunc(s, w):
|
||||
return "".join(result)
|
||||
|
||||
|
||||
def vis_offset(s, offset):
|
||||
"""Offset string by skipping first offset visual characters, skipping ANSI escape codes."""
|
||||
if offset <= 0:
|
||||
return s
|
||||
result = []
|
||||
vw = 0
|
||||
i = 0
|
||||
skipping = True
|
||||
while i < len(s):
|
||||
if s[i] == "\033" and i + 1 < len(s) and s[i + 1] == "[":
|
||||
j = i + 2
|
||||
while j < len(s) and not s[j].isalpha():
|
||||
j += 1
|
||||
if skipping:
|
||||
i = j + 1
|
||||
continue
|
||||
result.append(s[i : j + 1])
|
||||
i = j + 1
|
||||
else:
|
||||
if skipping:
|
||||
if vw >= offset:
|
||||
skipping = False
|
||||
result.append(s[i])
|
||||
vw += 1
|
||||
i += 1
|
||||
else:
|
||||
result.append(s[i])
|
||||
i += 1
|
||||
return "".join(result)
|
||||
|
||||
|
||||
def next_headline(pool, items, seen):
|
||||
"""Pull the next unique headline from pool, refilling as needed."""
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user