Skip to content
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

text: Improve accuracy and performance of caret placement in text #18446

Merged
merged 8 commits into from
Nov 4, 2024

Commits on Nov 4, 2024

  1. text: Fix gutter translation in screen_position_to_index

    When transforming TextField local coordinates to layout coordinates,
    we want to subtract the gutter, not add it.
    This fixes the weird 4px constant translation when selecting text.
    kjarosh authored and torokati44 committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    d445167 View commit details
    Browse the repository at this point in the history
  2. text: Add Layout::find_line_index_by_y

    This method allows finding lines by their y coordinates with binary search.
    kjarosh authored and torokati44 committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    840f004 View commit details
    Browse the repository at this point in the history
  3. text: Use binary search for finding lines in screen_position_to_index

    This simplifies code a lot and makes it more performant.
    kjarosh authored and torokati44 committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    d7711a9 View commit details
    Browse the repository at this point in the history
  4. tests: Add text_caret_placement_leading test

    This test verifies how the caret is placed in text with different leadings.
    kjarosh authored and torokati44 committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    6ce2bb6 View commit details
    Browse the repository at this point in the history
  5. tests: Add text_caret_placement_align test

    This test verifies how caret placement works depending on the align.
    kjarosh authored and torokati44 committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    7cafd9d View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ba43577 View commit details
    Browse the repository at this point in the history
  7. tests: Add text_caret_placement_translated_bounds test

    This test verifies how the caret placement works when
    bounds do not start with 0,0.
    kjarosh authored and torokati44 committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    61d0873 View commit details
    Browse the repository at this point in the history
  8. tests: Add text_caret_placement_scroll test

    This test verifies how the caret placement works with
    non-zero vertical and horizontal scroll.
    kjarosh authored and torokati44 committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    f4a15fd View commit details
    Browse the repository at this point in the history