Skip to content

Commit

Permalink
Merge pull request #20 from danwalmsley/fixes/fix-scrolling
Browse files Browse the repository at this point in the history
Fixes/fix scrolling
  • Loading branch information
danwalmsley authored May 16, 2017
2 parents 794723b + e0fc967 commit bf7d224
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/AvaloniaEdit/Editing/TextArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,11 @@ private void CaretPositionChanged(object sender, EventArgs e)
TextView.HighlightedLine = Caret.Line;

ScrollToLine(Caret.Line);

Dispatcher.UIThread.InvokeAsync(() =>
{
(this as ILogicalScrollable).InvalidateScroll?.Invoke();
});
}

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

SetAndRaise(OffsetProperty, ref _offset, value);
_offset = value;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/AvaloniaEdit/Rendering/TextView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,8 @@ internal void SetScrollOffset(Vector vector)
{
_scrollOffset = vector;
ScrollOffsetChanged?.Invoke(this, EventArgs.Empty);

InvalidateMeasure();
}
}

Expand Down

0 comments on commit bf7d224

Please sign in to comment.