Skip to content

Commit 26b4048

Browse files
committed
Fix #8: Click-dragging on the line number margin does not scroll
1 parent 9d5b4c5 commit 26b4048

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

ICSharpCode.AvalonEdit/Editing/LineNumberMargin.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
191191
if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) {
192192
ExtendSelection(currentSeg);
193193
}
194+
textArea.Caret.BringCaretToView(5.0);
194195
}
195196
}
196197
}
@@ -199,6 +200,7 @@ SimpleSegment GetTextLineSegment(MouseEventArgs e)
199200
{
200201
Point pos = e.GetPosition(TextView);
201202
pos.X = 0;
203+
pos.Y = pos.Y.CoerceValue(0, TextView.ActualHeight);
202204
pos.Y += TextView.VerticalOffset;
203205
VisualLine vl = TextView.GetVisualLineFromVisualTop(pos.Y);
204206
if (vl == null)
@@ -234,6 +236,7 @@ protected override void OnMouseMove(MouseEventArgs e)
234236
if (currentSeg == SimpleSegment.Invalid)
235237
return;
236238
ExtendSelection(currentSeg);
239+
textArea.Caret.BringCaretToView(5.0);
237240
}
238241
base.OnMouseMove(e);
239242
}

0 commit comments

Comments
 (0)