Skip to content

Index out of range measuring glyphs#190

Merged
Gillibald merged 17 commits intomasterfrom
index-out-of-range-measuring-glyphs
Jan 25, 2022
Merged

Index out of range measuring glyphs#190
Gillibald merged 17 commits intomasterfrom
index-out-of-range-measuring-glyphs

Conversation

@danipen
Copy link
Copy Markdown
Collaborator

@danipen danipen commented Jan 22, 2022

Fixes #189.

Fixed the following issues:

  • Fixed the IndexOutOfRange exception.
  • AvaloniaEdit now correctly places the caret when folded regions are displayed.
  • AvaloniaEdit now correctly places the caret when control characters are displayed.
  • AvaloniaEdit now correctly places the caret for tab characters.
  • Fixed caret navigation when mixing tab and spaces/chars.
  • Added unit tests.

Demo (using control characters and folding):

fix.mp4

Demo (mixing spaces and tabs now works as expected):

tabs.mp4

TextEmbeddedObject don't have a defined StringRange, so we cannot calculate the glyphWidths for them. The previous implementation used the embedded object size as glyph widths. I modified current implementation to behave in the same way.

Implemented the same for Tab TextRun.
Copy link
Copy Markdown
Contributor

@Gillibald Gillibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks!

@Gillibald Gillibald merged commit 5f023e6 into master Jan 25, 2022
@Takoooooo Takoooooo deleted the index-out-of-range-measuring-glyphs branch February 14, 2022 16:06
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.

Index out of range measuring glyphs

2 participants