Skip to content

Conversation

trijnsburger
Copy link

A rounding error occasionally occurs here (found when using RectangleSelect), causing this method to unexpectedly return null, which in turn causes RectangleSelection.ReplaceSelectionWithText() to incorrectly set textArea.Caret.Position to (Line = 1, Column = 1).

Note that the epsilon value of 1e-12 is an estimation based on the accuracy of the visualTop value, which has 13 decimals when its integer value is in the thousands (4 digits).

@siegfriedpammer
Copy link
Member

Can you please provide reproduction steps (using ICSharpCode.AvalonEdit.Sample.exe) for this problem? The GetVisualLineFromVisualTop method is used in a lot of contexts and I would prefer to not introduce any weird behavior due to magic constants.

I would expect the "lower than" relation to be not affected by epsilon errors.

Thanks!

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.

2 participants