diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/TextBoxView.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/TextBoxView.cs index 7e9b41040d83eed39ee295950d441f19c9bea92f..735ac71b47a81e1edc5c7e0facda9d4aecf14fac 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/TextBoxView.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/TextBoxView.cs @@ -1680,10 +1680,13 @@ private int GetLineIndexFromPoint(Point point, bool snapToText) } else { - if (!snapToText && - (point.X < 0 || point.X >= record.Width)) + if (!snapToText) { - index = -1; + double alignmentOffset = GetContentOffset(record.Width, CalculatedTextAlignment); + if (point.X < alignmentOffset || point.X >= record.Width + alignmentOffset) + { + index = -1; + } } break; }