Skip to content

Commit bf7d224

Browse files
author
danwalmsley
authored
Merge pull request #20 from danwalmsley/fixes/fix-scrolling
Fixes/fix scrolling
2 parents 794723b + e0fc967 commit bf7d224

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/AvaloniaEdit/Editing/TextArea.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,11 @@ private void CaretPositionChanged(object sender, EventArgs e)
616616
TextView.HighlightedLine = Caret.Line;
617617

618618
ScrollToLine(Caret.Line);
619+
620+
Dispatcher.UIThread.InvokeAsync(() =>
621+
{
622+
(this as ILogicalScrollable).InvalidateScroll?.Invoke();
623+
});
619624
}
620625

621626
public static readonly DirectProperty<TextArea, ObservableCollection<IControl>> LeftMarginsProperty
@@ -1075,7 +1080,7 @@ Vector IScrollable.Offset
10751080
{
10761081
TextView.SetScrollOffset(new Vector(value.X, value.Y * TextView.DefaultLineHeight));
10771082

1078-
SetAndRaise(OffsetProperty, ref _offset, value);
1083+
_offset = value;
10791084
}
10801085
}
10811086

src/AvaloniaEdit/Rendering/TextView.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,8 @@ internal void SetScrollOffset(Vector vector)
14221422
{
14231423
_scrollOffset = vector;
14241424
ScrollOffsetChanged?.Invoke(this, EventArgs.Empty);
1425+
1426+
InvalidateMeasure();
14251427
}
14261428
}
14271429

0 commit comments

Comments
 (0)