Files
goose/ui
spencrmartin 08fb455eac Fix highlight offset by ensuring line height consistency
Fixed the issue where highlights (spell check, selection) were offset from
text due to inconsistent line height calculations between layers:

1. Dynamic line height calculation:
   - Replaced hardcoded 21px with computed line height from actual textarea
   - Uses window.getComputedStyle() to get real rendered line height
   - Handles both 'normal' and explicit line height values properly

2. Explicit line height synchronization:
   - Sets both textarea and display layers to use identical pixel line heights
   - Added ensureLineHeightConsistency() function for ongoing sync
   - Called after every height sync to maintain consistency

3. Consistent cursor positioning:
   - Updated resetHeight method to use calculated line height
   - All line-based calculations now use the same computed value
   - Eliminates discrepancies between layers

This ensures that spell check highlights, selection highlights, and cursor
positioning are perfectly aligned with the actual rendered text, regardless
of font size, browser differences, or CSS inheritance.
2025-10-31 09:12:20 -04:00
..