mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-22 20:37:19 -08:00
Better navigation algorithm to go to NEXT/PREV difference in DiffViewer
This commit is contained in:
parent
a8426fc085
commit
3c896c33be
1 changed files with 6 additions and 6 deletions
|
@ -333,7 +333,7 @@ namespace SourceGit.UI {
|
|||
foreach (var p in leftText.Document.Blocks) {
|
||||
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
||||
var block = p.DataContext as Git.Diff.Block;
|
||||
if (rect.Top > 0 && block.IsLeftDelete) {
|
||||
if (rect.Top > 17 && block.IsLeftDelete) {
|
||||
next = p as Paragraph;
|
||||
minTop = rect.Top;
|
||||
break;
|
||||
|
@ -343,7 +343,7 @@ namespace SourceGit.UI {
|
|||
foreach (var p in rightText.Document.Blocks) {
|
||||
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
||||
var block = p.DataContext as Git.Diff.Block;
|
||||
if (rect.Top > 0 && block.IsRightAdded) {
|
||||
if (rect.Top > 17 && block.IsRightAdded) {
|
||||
if (next == null || minTop > rect.Top) {
|
||||
next = p as Paragraph;
|
||||
minTop = rect.Top;
|
||||
|
@ -354,7 +354,7 @@ namespace SourceGit.UI {
|
|||
}
|
||||
|
||||
if (next != null) {
|
||||
rightText.ScrollToVerticalOffset(rightText.VerticalOffset + minTop);
|
||||
rightText.ScrollToVerticalOffset(rightText.VerticalOffset + minTop - 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ namespace SourceGit.UI {
|
|||
do {
|
||||
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
||||
var block = p.DataContext as Git.Diff.Block;
|
||||
if (rect.Top < 0 && block.IsLeftDelete) {
|
||||
if (rect.Top < 15 && block.IsLeftDelete) {
|
||||
next = p;
|
||||
maxTop = rect.Top;
|
||||
break;
|
||||
|
@ -384,7 +384,7 @@ namespace SourceGit.UI {
|
|||
do {
|
||||
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
||||
var block = p.DataContext as Git.Diff.Block;
|
||||
if (rect.Top < 0 && block.IsRightAdded) {
|
||||
if (rect.Top < 15 && block.IsRightAdded) {
|
||||
if (next == null || maxTop < rect.Top) {
|
||||
next = p;
|
||||
maxTop = rect.Top;
|
||||
|
@ -397,7 +397,7 @@ namespace SourceGit.UI {
|
|||
} while (p != null);
|
||||
|
||||
if (next != null) {
|
||||
rightText.ScrollToVerticalOffset(rightText.VerticalOffset + maxTop);
|
||||
rightText.ScrollToVerticalOffset(rightText.VerticalOffset + maxTop - 16);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue