Skip to content

fix(tui): implement dynamic text-wrapping in observation detail view#82

Open
Twinber wants to merge 2 commits intoGentleman-Programming:mainfrom
Twinber:fix/tui-wrapping
Open

fix(tui): implement dynamic text-wrapping in observation detail view#82
Twinber wants to merge 2 commits intoGentleman-Programming:mainfrom
Twinber:fix/tui-wrapping

Conversation

@Twinber
Copy link

@Twinber Twinber commented Mar 15, 2026

fix(tui): Implement dynamic soft-wrapping in observation detail view

Summary

Improved the readability of the TUI by implementing dynamic text wrapping for observation content. This ensures that long lines (prompts, logs, or detailed notes) are fully visible regardless of the terminal window size.

  • Dynamic Wrapping: Content is now wrapped using Lipgloss based on terminal width before pagination.
  • Robust Scrolling: The scroll/pagination logic was updated to work with the multi-line wrapped content accurately.
  • Verification Suite: Introduced a new unit test to ensure wrapping logic remains consistent in future updates.

Motivation

Previously, long observations were truncated at the viewport boundaries, making it impossible to read the full content without side-scrolling. This change addresses a long-standing readability issue and makes the TUI far more robust for technical documentation.

Closes #60
Closes #83

Changes

internal/tui/view.go

  • Refactored viewObservationDetail to calculate a dynamic wrapWidth (terminal width minus padding).
  • Applied detailContentStyle.Width(wrapWidth).Render(obs.Content) before splitting into lines.
  • Updated the content rendering loop to handle the pre-rendered wrapped lines.

internal/tui/wrap_test.go [NEW]

  • Added TestViewObservationDetailWrapping to programmatically verify that long content is correctly split into multiple lines when it exceeds the assigned width.

Validation

  • Unit Testing: All internal/tui tests passed.
  • New Test Case: TestViewObservationDetailWrapping confirms the fix.
  • Manual TUI Check: Verified with high-density markdown content and varied terminal widths.

Twinber added 2 commits March 15, 2026 13:13
- Updated internal/tui/view.go to use Lipgloss for dynamic wrapping based on window width.
- Added comprehensive unit test in internal/tui/wrap_test.go to verify wrapping logic.
- Ensured long observation content is no longer cut off at the viewport boundaries.

This improvement addresses readability issues when viewing large technical or personal memories.
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.

[TUI] Long observation content truncated in detail view BUG: Texto engram tui no se visualiza completamente

1 participant