Skip to content

Enable text selection and search in deleted lines for diff editor #246407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

10xDad
Copy link

@10xDad 10xDad commented Apr 13, 2025

Fixes #8226

This PR addresses a long-standing issue where users cannot select text in deleted lines within the diff editor. Additionally, it enhances the search functionality to include deleted content in search results.

Changes

  1. CSS Modifications:

    • Enabled text selection on deleted lines and their child elements
    • Preserved existing styling while making content selectable
    • Added proper cursor behavior for interactive elements
  2. DiffEditorWidget Enhancements:

    • Added dynamic selection enabling using MutationObserver
    • Enhanced search functionality to include deleted lines
    • Implemented proper highlighting for search matches in deleted content
  3. Test Coverage:

    • Added comprehensive tests for text selection functionality
    • Added tests for search integration
    • Included edge case testing for nested elements

Technical Details

  • Uses MutationObserver for efficient DOM updates
  • Maintains VSCode's performance standards
  • Preserves existing diff editor functionality
  • Follows VSCode's architectural patterns

Testing

The changes have been tested for:

  • Text selection in deleted lines
  • Search functionality including deleted content
  • Performance impact (minimal)
  • Compatibility with existing features
  • Edge cases with nested elements

Screenshots

[Will add screenshots showing before/after comparisons]

Notes

  • This implementation maintains backward compatibility
  • No breaking changes introduced
  • Minimal performance overhead
  • Follows accessibility best practices

Related Issues

@hediet
Copy link
Member

hediet commented Apr 29, 2025

Thanks for the PR! Unfortunately it seems to have some issues, so we have to reject it.

@hediet hediet closed this Apr 29, 2025
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.

Cannot select text from deleted lines diff view
2 participants