Commit graph

77 commits

Author SHA1 Message Date
Mario Zechner
85b2eadf40 Fix cursor positioning by using XTerm's absolute buffer coordinates
- Fix cursor Y calculation by adding XTerm's viewportY offset to get absolute buffer position
- Simplify cursor line detection logic by removing complex viewport translation
- Write full content in test instead of truncated lines
- Ensure scrollToBottom only runs after terminal is properly fitted

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 02:10:07 +02:00
Mario Zechner
f6f84fb351 Fix viewportY actually being used in DOM terminal rendering
- Replace incorrect Math.min logic with proper viewport bounds checking
- Now properly uses viewportY as the primary scroll position for rendering
- Ensures terminal shows correct viewport content when scrolled up/down

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 01:39:55 +02:00
Mario Zechner
91d454f503 Fix cursor positioning in DOM terminal viewport scrolling
- Add proper cursor coordinate system translation between XTerm logical size and viewport size
- Fix cursor positioning when viewport is scrolled up by adjusting cursor Y offset
- Clean up unused variables and fix linting warnings
- Ensure XTerm write callback timing for performance measurement

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 01:35:57 +02:00
Mario Zechner
992cea9a91 Fix cursor positioning and remove restrictive API safety checks
- Fix cursor viewport positioning by checking if cursor is within current viewport range
- Remove restrictive queue safety checks from immediate query methods
- Update API documentation to clarify when data may be stale and suggest queueCallback() for fresh data
- Simplify test to use proper API flow without unnecessary timeouts
- Cursor now correctly renders only when visible in viewport at proper position

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 01:16:28 +02:00
Mario Zechner
7974dca8b8 Add comprehensive DOM terminal API with cursor rendering and performance tracking
- Implement RAF-based operation queue for optimal batching
- Add cursor position rendering with nice green color and blinking animation
- Add comprehensive public API with documentation:
  - Buffer methods: write(), clear(), setTerminalSize()
  - Scroll methods: scrollToBottom(), scrollTo(), queueCallback()
  - Query methods: getTerminalSize(), getVisibleRows(), getBufferSize(), getScrollPosition(), getMaxScrollPosition()
- Add safety checks to prevent stale data reads when operations are pending
- Add detailed performance measurement for render pipeline
- Update test to use proper encapsulated API instead of accessing internals

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 01:03:02 +02:00
Mario Zechner
06750ed405 Stop URL parsing at empty lines
- Add check for empty lines (after trimming) to stop URL parsing
- URLs now properly end at empty lines, not just whitespace
- More intuitive behavior for multi-line URL detection

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 00:26:38 +02:00
Mario Zechner
97143abc20 Simplify multi-line URL detection with whitespace-based approach
- Detect http(s):// in current line with regex
- Scan subsequent lines until first whitespace character
- Much simpler and more reliable than URL validation
- Use actual <a> tags instead of spans for proper linking
- Remove complex string highlighting (focus on URLs only)
- Cleaner, more maintainable code

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 00:24:17 +02:00
Mario Zechner
98bb30f89f Add multi-line string highlighting to DOM terminal
- Detect quoted strings (single, double, backtick quotes)
- Highlight strings that span multiple lines or are >20 chars
- Style strings with orange color and subtle background
- Handle overlap detection (URLs take precedence over strings)
- Add comprehensive test cases for multi-line strings
- Fix method naming and maintain scrolling functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 00:19:04 +02:00
Mario Zechner
d4902f1d31 Implement clickable links in DOM terminal
- Add multi-line URL detection and linking
- Extract text across all terminal lines for processing
- Handle URLs that span multiple lines correctly
- Style links with hover effects and click handlers
- Add comprehensive link test cases to test HTML
- Process links after each render operation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 00:16:25 +02:00
Mario Zechner
885612f69b Minor fix 2025-06-18 00:10:53 +02:00
Mario Zechner
cc244031ff Add missing session fields and update linting guidance
- Add waiting field to Session interface in session-list.ts
- Include name and waiting fields in app.ts session mapping
- Update CLAUDE.md with linting reminder

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 00:08:57 +02:00
Mario Zechner
12eaa39d73 Fix mobile horizontal fit with Fira Code font consistency
- Remove debug logging after confirming font fix works
- Fira Code provides consistent character width across platforms
- Horizontal fit now works reliably on real devices and emulators
- Minimum font size of 4px enables proper mobile fitting

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 00:04:02 +02:00
Mario Zechner
3ef137b78d Add back debug logging for real device testing
- Restore detailed horizontal fit logging
- Compare real device vs emulator font rendering
- Identify discrepancies in character width measurement

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-18 00:00:16 +02:00
Mario Zechner
4077977194 Remove debug logging from terminal component
- Clean up console.log statements added for debugging
- Keep the mobile horizontal fit improvements
- Maintain explicit font styling for measurement accuracy

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 23:57:12 +02:00
Mario Zechner
d1e98a6f81 Fix horizontal fit on mobile by lowering min font size
- Reduce minimum font size from 8px to 4px for mobile
- Explicitly set fontSize and fontFamily on measurement element
- Add fontSize to measurement logging
- Allows proper fitting for narrow mobile viewports

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 23:55:52 +02:00
Mario Zechner
f5694cecbf Add detailed logging for horizontal fit debugging
- Add character width measurement logging
- Show container dimensions and target calculations
- Log scale factor and font size adjustments
- Help debug mobile horizontal fit issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 23:54:19 +02:00
Mario Zechner
46ce5ffc56 Rename terminal component to vibe-terminal
- Change @customElement from 'terminal' to 'vibe-terminal'
- Update HTML test file to use new element name
- Fixes web component spec compliance (terminal is reserved)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 23:51:13 +02:00
Mario Zechner
925bc129c9 Add optional session name support
- Add optional session name field to create form
- Update Session interface to include name property
- Backend now accepts and stores custom session names
- Session cards and views display name when available, fallback to command
- Session names are passed to tty-fwd for better identification

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 23:45:55 +02:00
Mario Zechner
689bd1d765 Fix linter issues and limit session grid to 2 columns
- Remove unused css import in mobile-terminal component
- Fix unused location parameter in custom-weblinks-addon
- Limit session list grid to maximum 2 cards per row

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 23:40:08 +02:00
Mario Zechner
2650058bb9 Rename dom-terminal to terminal component
Renamed the DOM terminal component for cleaner naming:
- Renamed dom-terminal.ts to terminal.ts
- Renamed DomTerminal class to Terminal
- Renamed XTerm Terminal import to XtermTerminal to avoid conflicts
- Updated custom element from 'dom-terminal' to 'terminal'
- Updated CSS classes from dom-terminal-container to terminal-container
- Updated HTML test file to use new element name and CSS classes
- Updated import in test-terminals-entry.ts
- Fixed linting issues (removed unused variables)

The terminal component now has cleaner, more intuitive naming while
maintaining all existing functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 23:32:55 +02:00
Mario Zechner
2179f25025 Add horizontal fitting mode for terminal with toggle button
Implemented responsive terminal sizing that automatically adjusts font size
to fit exactly the specified number of columns in the container width:
- Added fitHorizontally property to toggle horizontal fitting mode
- Character width measurement using representative terminal content
- Automatic font size calculation to fit columns exactly
- Full container utilization by fitting both columns and rows
- Proper font size restoration when toggling off horizontal fitting
- Added toggle button to test page for easy testing

The terminal now supports two modes:
- Normal: Fixed font size, calculate rows that fit vertically
- Horizontal fit: Calculate font size to fit columns, then fit rows

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 23:26:14 +02:00
Mario Zechner
322658d9a9 Add smooth macOS-style momentum scrolling for mobile touch
Implemented natural momentum scrolling that feels like native macOS:
- Fixed velocity calculation to use recent movement instead of total
- Added macOS-like deceleration curve with variable friction
- Smooth start with gentle initial deceleration, then gradual slowdown
- Fractional scroll accumulation prevents small movements from being lost
- Removed debug logging for clean production code

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 22:57:40 +02:00
Mario Zechner
e464872b15 Fix mobile touch scrolling with pointer events and capture
Replaced touch events with pointer events using setPointerCapture() to solve
the issue where touch scrolling would break when DOM is rebuilt during scroll.
- Use pointer events with setPointerCapture() for touch devices only
- Keep wheel events for desktop trackpad/mouse scrolling
- Add touch-action: none CSS to prevent browser scroll interference
- Include 5px movement threshold to avoid interfering with text selection
- Remove momentum scrolling temporarily for simplicity

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 22:49:44 +02:00
Mario Zechner
0e4d202d71 Fix smooth scrolling on Mac trackpads with delta accumulation
- Add scroll accumulator to handle small deltaY values from slow trackpad movements
- Accumulate scroll deltas until they reach at least one line height
- Preserve fractional remainder for next scroll event
- Fixes issue where slow two-finger scrolling would not register movement

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 22:13:28 +02:00
Mario Zechner
5ca8acb676 Improve DOM terminal renderer and add rich test content
- Fix DOM terminal rendering with proper innerHTML generation
- Add comprehensive test content including logs, tables, git history, docker status
- Implement proper ANSI color code handling for wide character compatibility
- Add auto-scroll to bottom functionality
- Replace individual line element management with bulk innerHTML updates
- Fix \r\n line ending handling for proper terminal behavior

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 22:10:48 +02:00
Mario Zechner
b4d63fc922 New terminal renderer WIP 2025-06-17 22:10:48 +02:00
Mario Zechner
113786a35b Add responsive mobile terminal component with viewport scaling
- Created ResponsiveTerminal Lit component with mobile touch scrolling
- Implements XTerm.js with custom scaling algorithm for different viewport sizes
- Added setViewportSize() method for testing content reflow without regeneration
- Fixed mobile viewport issues using 100dvh for proper height calculation
- Added debounced ResizeObserver to prevent resize loops
- Component uses Tailwind classes and aggressive XTerm CSS constraints
- Test page allows switching viewport dimensions to observe content reflow
- Touch handlers scoped only to terminal content, not affecting external UI

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 16:09:09 +02:00
Mario Zechner
c04cb26f4e Fix linter formatting issues
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 01:52:52 +02:00
Mario Zechner
7e98e2e735 Fira font, various mobile UI fixes. 2025-06-17 01:38:58 +02:00
Peter Steinberger
52fda3d996 linting 2025-06-17 01:11:10 +02:00
Peter Steinberger
8b3833ee0e Merge remote-tracking branch 'origin/main'
# Conflicts:
#	web/src/client/components/app-header.ts
#	web/src/client/components/session-card.ts
#	web/src/client/components/session-view.ts
2025-06-17 01:06:52 +02:00
Peter Steinberger
bb20c3a833 lint web 2025-06-17 01:03:37 +02:00
Mario Zechner
fb0c3538f2 Mobile fixes. 2025-06-17 00:47:19 +02:00
Peter Steinberger
59ad90fdc7 Move kill to app header 2025-06-17 00:28:39 +02:00
Mario Zechner
b54dc7a17c Fix terminal cursor not showing up 2025-06-17 00:20:48 +02:00
Mario Zechner
16f139ce89 Log websocket error, don't throw. 2025-06-17 00:20:38 +02:00
Mario Zechner
ddb342bdec Fix the stupid terminal scaling calculations, we properly measure glyph width/height and apply linear scaling plus conservative row clamping. Good enough. Scroll could be reset to bottom after fit, but might also kill user scroll position so shrug. 2025-06-16 22:56:21 +02:00
Armin Ronacher
71f49142ea Show waiting status 2025-06-16 21:39:37 +02:00
Armin Ronacher
013ba77a04 Fix cursor rendering 2025-06-16 19:19:18 +02:00
Armin Ronacher
510be54304 Implemented copy/paste 2025-06-16 18:28:43 +02:00
Mario Zechner
ab5a34398d Improve mobile UI and add localStorage for session creation
- Add localStorage persistence for last used working directory and command
- Values are saved on successful session creation and loaded on component creation
- Survives page reloads and provides better UX for repeated session creation
- Enhance mobile terminal buttons with larger Unicode symbols (arrows, tab, enter)
- Make arrow keys, tab, and enter buttons more visible and easier to tap

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 17:46:44 +02:00
Mario Zechner
d164db3496 Add Kill All sessions button and fix terminal scaling
- Add Kill All button to session list that appears when running sessions exist
- Button triggers individual session kill animations by clicking each kill button
- Fix terminal scaling issues with proper character width ratio (0.63)
- Constrain terminal containers to viewport width to prevent overflow
- Override XTerm's fixed width CSS to respect container bounds
- Reduce minimum font size to 4px for better scaling flexibility

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 17:37:48 +02:00
Mario Zechner
c5a6e2dd1d Remove unnecessary session polling from session-view
Session-view was polling /api/sessions every 2 seconds unnecessarily.
All session updates come via SSE stream including exit events.
This eliminates redundant API calls and improves performance.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 16:08:28 +02:00
Mario Zechner
ed3927b4a6 Fix session management and terminal scaling
- Fix session killing via DELETE endpoint instead of wrong POST /kill
- Add proper session card kill animation with ASCII spinner
- Fix double key press issue with keyed directive for session-view
- Implement URL-based navigation for consistent component lifecycle
- Fix session card terminal scaling to show all content at smaller sizes
- Modify ScaleFitAddon to only scale font size for previews, not dimensions
- Add session card loading and killing states with visual feedback
- Remove duplicate event listeners and improve component cleanup

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 15:35:11 +02:00
Mario Zechner
90eb324930 Fix session card styling to match original design
- Restore compact header layout with proper spacing (px-3 py-2)
- Use original VS Code theme colors (text-vs-user, text-vs-warning)
- Fix terminal preview with proper aspect ratio (640/480)
- Update kill button styling to match original (bg-vs-warning)
- Add compact footer with session ID and working directory

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 14:59:24 +02:00
Mario Zechner
ae2c986e33 Implement session-card architecture and improve session management
- Create session-card component for individual session rendering
- Add Renderer active count tracking to monitor instance leaks
- Parse session ID from tty-fwd stdout for reliable session creation
- Add 2-second delay for fresh session connections to prevent race conditions
- Simplify session-list to use session-card components
- Restore original layout with controls and proper padding
- Improve SSE exit event handling with direct session ID usage

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 13:50:28 +02:00
Mario Zechner
3ec417c8b1 Implement custom ScaleFitAddon for proper terminal scaling
- Create ScaleFitAddon that scales font size to fit columns to container width
- Calculates optimal rows for container height with scaled font
- Replace CSS transform scaling with proper font size calculation
- Apply to both session view and previews for consistent behavior
- Achieve 95-98% width utilization instead of arbitrary 80% scaling
- Prevent stack overflow with font size change detection

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 12:06:42 +02:00
Mario Zechner
34801bc687 Fix terminal layout and improve mobile UX
- Restructure session-view to use proper flexbox layout (header/xterm/buttons)
- Container now exactly fits viewport height (100vh)
- Header shows command and working directory stacked
- XTerm gets all remaining space with horizontal scrolling
- Mobile buttons integrated into layout instead of overlaying
- Replace setTimeout with requestAnimationFrame for better performance
- Add isPreview parameter to renderer for future preview scaling
- Disable pointer events on preview terminals so clicks pass through

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 11:55:22 +02:00
Mario Zechner
093aff4379 Update XTerm theme to VS Code Dark colors and improve SSE streaming
- Replace Gruvbox color scheme with VS Code Dark theme colors
- Remove inappropriate terminal.clear() calls from live stream connections
- Add debugging logs for SSE events to investigate DOM recreation issue
- Ensure only snapshots clear terminal, streams append new content

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 10:58:21 +02:00
Mario Zechner
e8bee03388 Replace asciinema with XTerm renderer and add key combination support
- Replace AsciinemaPlayer with XTerm.js renderer in session-view and session-list
- Add XTerm CSS for proper terminal styling and hide input textarea
- Implement resize event handling (r-type cast events) in renderer
- Add Ctrl+Enter and Shift+Enter key combination support
- Update tty-fwd to handle ctrl_enter and shift_enter keys
- Set TERM=xterm-256color in tty-fwd for proper Unicode box-drawing
- Add font scaling and preview sizing for session-list terminals
- Remove asciinema dependencies and update CSS accordingly

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-16 10:38:19 +02:00