Skip to content

Comments

Add terminal layout resize logging#30

Open
randlee wants to merge 7 commits intodevelopfrom
feature/arch-codex-cursor-investigation
Open

Add terminal layout resize logging#30
randlee wants to merge 7 commits intodevelopfrom
feature/arch-codex-cursor-investigation

Conversation

@randlee
Copy link
Owner

@randlee randlee commented Feb 1, 2026

Summary

  • add terminal layout resize logging gated by TERMINALG_DEBUG_RESIZE

Testing

  • cargo fmt -- --check

randlee and others added 7 commits January 30, 2026 13:45
Two issues fixed:

1. Added mouse event handlers to divider element
   - on_mouse_move to track drag position
   - on_mouse_up to end drag
   Previously events were only on parent, but mouse moves off divider during drag

2. Fixed calculate_new_ratios ratio calculation
   - Was incorrectly assuming ratios sum to 1.0 (visible_ratio_total = 1.0 - hidden)
   - Actually ratios are [1.0, 2.0, 1.0] summing to 4.0
   - Now correctly sums visible ratios for proper width calculation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The custom cursor rendering was causing layout problems, particularly
with TUI applications like Claude Code where the cursor appeared in
the wrong position (below the status line) and caused the UI to shift.

Changes:
- Add display_offset, line_offset, viewport_rows to TerminalContentSnapshot
- Improve build_lines_from_content to handle non-zero starting line indices
- Disable custom cursor rendering (TODO: implement proper cursor following
  Zed's terminal_element.rs approach)

The terminal content from alacritty already handles cursor visualization
through cell attributes, so disabling the custom cursor overlay provides
a better user experience until proper cursor rendering is implemented.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Following Zed's terminal_element.rs patterns:
- Add DisplayCursor struct with from(cursor_point, display_offset)
- Use BTreeMap for line grouping with enumerated screen positions
- Add shape_cursor function with viewport bounds checking
- Re-enable cursor rendering with proper coordinate transformation

The key insight from Zed: cursor.line.0 + display_offset transforms
Alacritty's coordinate system (negative scrollback) into screen
coordinates (0, 1, 2...).

References: zed/crates/terminal_view/src/terminal_element.rs
- DisplayCursor: lines 59-79
- shape_cursor: lines 504-528
- Cell enumeration: lines 1117-1124
- Cursor creation: line 1137

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The custom cursor was rendering in the wrong position (below the
status bar in TUI apps like Claude Code). Disabling it makes the
terminal more usable while we investigate the root cause.

Investigation findings:
- Coordinate transformation (line.0 + display_offset) appears correct
- Content and cursor use same coordinate system
- Spacing issue (UI shifted 1 line) exists independently of cursor
- Root cause still under investigation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant