[PR #9586] fix: correct dot prefix display in file paths for directories starting with dots #13154

Closed
opened 2026-02-16 18:18:01 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9586

State: closed
Merged: No


Summary

Fixes file path display bug where dot prefixes from directory names (e.g., .opencode/) were incorrectly appearing on filenames due to CSS direction: rtl triggering Unicode bidirectional text reordering.

Description

  • Added Left-to-Right Mark (‎) prefix to directory path displays
  • Moved existing ‎ from suffix to prefix in session-review and session-turn components
  • Added ‎ prefix to message-part edit and write tools
  • Fixes issue where .opencode/commands/README.md displayed as opencode/commands/.README.md
  • The direction: rtl property is used for left-truncation of long paths, but it caused the Unicode Bidirectional Algorithm to reorder neutral characters like dots
  • LRM prefix explicitly marks the text as left-to-right from the beginning, preventing the reordering

Solution: LRM Prefix vs CSS unicode-bidi

This PR uses the LRM (Left-to-Right Mark) prefix approach rather than CSS unicode-bidi: plaintext because:

More production-ready - Already used in this codebase (just needed repositioning)
Lower risk - Surgical change that can't cascade to unintended elements
Battle-tested - Used by Wikipedia, Google, and major sites for decades
Universal browser support - Works even in ancient browsers
Explicit intent - Clear to future developers why it's there

Root Cause

The CSS direction: rtl property triggers the Unicode Bidirectional Algorithm (UBA), which treats the dot (.) as a neutral/punctuation character and moves it to the visual "end" of the RTL text block. Since the directory <span> is immediately followed by the filename <span>, the visually-reordered dot appeared adjacent to the filename.

Files Changed

  • packages/ui/src/components/session-review.tsx - Moved LRM to prefix
  • packages/ui/src/components/session-turn.tsx - Moved LRM to prefix
  • packages/ui/src/components/message-part.tsx - Added LRM prefix in Edit and Write tools

Test Plan

  1. Create a directory with a dot prefix (e.g., .opencode/commands/)
  2. Create files inside it (e.g., README.md, analyze-issue.md)
  3. Make changes to these files in OpenCode Desktop
  4. Open the "Session changes" panel (Review tab)
  5. Verify that paths display correctly as .opencode/commands/README.md
  6. Verify the directory path still truncates from the left when too long
  7. Test with other dot-prefixed directories (.github/, .cursor/, etc.)
  8. Test in Edit and Write tool displays

Browser Compatibility

The LRM character (U+200E) is universally supported across all browsers and has been part of Unicode since version 1.0 (1991).

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have walked through my test plan
  • The fix is minimal and targeted (4 character position changes)
  • No breaking changes or side effects
  • Uses existing patterns already in the codebase

Closes #9579

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9586 **State:** closed **Merged:** No --- ## Summary Fixes file path display bug where dot prefixes from directory names (e.g., `.opencode/`) were incorrectly appearing on filenames due to CSS `direction: rtl` triggering Unicode bidirectional text reordering. ## Description - Added Left-to-Right Mark (`&lrm;`) prefix to directory path displays - Moved existing `&lrm;` from suffix to prefix in session-review and session-turn components - Added `&lrm;` prefix to message-part edit and write tools - Fixes issue where `.opencode/commands/README.md` displayed as `opencode/commands/.README.md` - The `direction: rtl` property is used for left-truncation of long paths, but it caused the Unicode Bidirectional Algorithm to reorder neutral characters like dots - LRM prefix explicitly marks the text as left-to-right from the beginning, preventing the reordering ## Solution: LRM Prefix vs CSS unicode-bidi This PR uses the **LRM (Left-to-Right Mark) prefix approach** rather than CSS `unicode-bidi: plaintext` because: ✅ **More production-ready** - Already used in this codebase (just needed repositioning) ✅ **Lower risk** - Surgical change that can't cascade to unintended elements ✅ **Battle-tested** - Used by Wikipedia, Google, and major sites for decades ✅ **Universal browser support** - Works even in ancient browsers ✅ **Explicit intent** - Clear to future developers why it's there ## Root Cause The CSS `direction: rtl` property triggers the Unicode Bidirectional Algorithm (UBA), which treats the dot (`.`) as a neutral/punctuation character and moves it to the visual "end" of the RTL text block. Since the directory `<span>` is immediately followed by the filename `<span>`, the visually-reordered dot appeared adjacent to the filename. ## Files Changed - `packages/ui/src/components/session-review.tsx` - Moved LRM to prefix - `packages/ui/src/components/session-turn.tsx` - Moved LRM to prefix - `packages/ui/src/components/message-part.tsx` - Added LRM prefix in Edit and Write tools ## Test Plan 1. Create a directory with a dot prefix (e.g., `.opencode/commands/`) 2. Create files inside it (e.g., `README.md`, `analyze-issue.md`) 3. Make changes to these files in OpenCode Desktop 4. Open the "Session changes" panel (Review tab) 5. Verify that paths display correctly as `.opencode/commands/README.md` 6. Verify the directory path still truncates from the left when too long 7. Test with other dot-prefixed directories (`.github/`, `.cursor/`, etc.) 8. Test in Edit and Write tool displays ## Browser Compatibility The LRM character (`U+200E`) is universally supported across all browsers and has been part of Unicode since version 1.0 (1991). ## Checklist - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have walked through my test plan - [x] The fix is minimal and targeted (4 character position changes) - [x] No breaking changes or side effects - [x] Uses existing patterns already in the codebase Closes #9579
yindo added the pull-request label 2026-02-16 18:18:01 -05:00
yindo closed this issue 2026-02-16 18:18:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13154