Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions src/AvaloniaEdit/TextEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -711,71 +711,71 @@ public void EndChange()
/// </summary>
public void LineDown()
{
//if (scrollViewer != null)
// scrollViewer.LineDown();
ApplyTemplate(); // ensure scrollViewer is created
ScrollViewer?.LineDown();
}

/// <summary>
/// Scrolls to the left.
/// </summary>
public void LineLeft()
{
//if (scrollViewer != null)
// scrollViewer.LineLeft();
ApplyTemplate(); // ensure scrollViewer is created
ScrollViewer?.LineLeft();
}

/// <summary>
/// Scrolls to the right.
/// </summary>
public void LineRight()
{
//if (scrollViewer != null)
// scrollViewer.LineRight();
ApplyTemplate(); // ensure scrollViewer is created
ScrollViewer?.LineRight();
}

/// <summary>
/// Scrolls one line up.
/// </summary>
public void LineUp()
{
//if (scrollViewer != null)
// scrollViewer.LineUp();
ApplyTemplate(); // ensure scrollViewer is created
ScrollViewer?.LineUp();
}

/// <summary>
/// Scrolls one page down.
/// </summary>
public void PageDown()
{
//if (scrollViewer != null)
// scrollViewer.PageDown();
ApplyTemplate(); // ensure scrollViewer is created
ScrollViewer?.PageDown();
}

/// <summary>
/// Scrolls one page up.
/// </summary>
public void PageUp()
{
//if (scrollViewer != null)
// scrollViewer.PageUp();
ApplyTemplate(); // ensure scrollViewer is created
ScrollViewer?.PageUp();
}

/// <summary>
/// Scrolls one page left.
/// </summary>
public void PageLeft()
{
//if (scrollViewer != null)
// scrollViewer.PageLeft();
ApplyTemplate(); // ensure scrollViewer is created
ScrollViewer?.PageLeft();
}

/// <summary>
/// Scrolls one page right.
/// </summary>
public void PageRight()
{
//if (scrollViewer != null)
// scrollViewer.PageRight();
ApplyTemplate(); // ensure scrollViewer is created
ScrollViewer?.PageRight();
}

/// <summary>
Expand Down Expand Up @@ -827,8 +827,8 @@ public void ScrollToHome()
public void ScrollToHorizontalOffset(double offset)
{
ApplyTemplate(); // ensure scrollViewer is created
//if (scrollViewer != null)
// scrollViewer.ScrollToHorizontalOffset(offset);
if (ScrollViewer is { } scrollViewer)
scrollViewer.Offset = scrollViewer.Offset.WithX(offset);
}

/// <summary>
Expand All @@ -837,8 +837,8 @@ public void ScrollToHorizontalOffset(double offset)
public void ScrollToVerticalOffset(double offset)
{
ApplyTemplate(); // ensure scrollViewer is created
//if (scrollViewer != null)
// scrollViewer.ScrollToVerticalOffset(offset);
if (ScrollViewer is { } scrollViewer)
scrollViewer.Offset = scrollViewer.Offset.WithY(offset);
}

/// <summary>
Expand Down