mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57: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) {
|
foreach (var p in leftText.Document.Blocks) {
|
||||||
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
||||||
var block = p.DataContext as Git.Diff.Block;
|
var block = p.DataContext as Git.Diff.Block;
|
||||||
if (rect.Top > 0 && block.IsLeftDelete) {
|
if (rect.Top > 17 && block.IsLeftDelete) {
|
||||||
next = p as Paragraph;
|
next = p as Paragraph;
|
||||||
minTop = rect.Top;
|
minTop = rect.Top;
|
||||||
break;
|
break;
|
||||||
|
@ -343,7 +343,7 @@ namespace SourceGit.UI {
|
||||||
foreach (var p in rightText.Document.Blocks) {
|
foreach (var p in rightText.Document.Blocks) {
|
||||||
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
||||||
var block = p.DataContext as Git.Diff.Block;
|
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) {
|
if (next == null || minTop > rect.Top) {
|
||||||
next = p as Paragraph;
|
next = p as Paragraph;
|
||||||
minTop = rect.Top;
|
minTop = rect.Top;
|
||||||
|
@ -354,7 +354,7 @@ namespace SourceGit.UI {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next != null) {
|
if (next != null) {
|
||||||
rightText.ScrollToVerticalOffset(rightText.VerticalOffset + minTop);
|
rightText.ScrollToVerticalOffset(rightText.VerticalOffset + minTop - 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ namespace SourceGit.UI {
|
||||||
do {
|
do {
|
||||||
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
||||||
var block = p.DataContext as Git.Diff.Block;
|
var block = p.DataContext as Git.Diff.Block;
|
||||||
if (rect.Top < 0 && block.IsLeftDelete) {
|
if (rect.Top < 15 && block.IsLeftDelete) {
|
||||||
next = p;
|
next = p;
|
||||||
maxTop = rect.Top;
|
maxTop = rect.Top;
|
||||||
break;
|
break;
|
||||||
|
@ -384,7 +384,7 @@ namespace SourceGit.UI {
|
||||||
do {
|
do {
|
||||||
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
var rect = p.ContentStart.GetCharacterRect(LogicalDirection.Forward);
|
||||||
var block = p.DataContext as Git.Diff.Block;
|
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) {
|
if (next == null || maxTop < rect.Top) {
|
||||||
next = p;
|
next = p;
|
||||||
maxTop = rect.Top;
|
maxTop = rect.Top;
|
||||||
|
@ -397,7 +397,7 @@ namespace SourceGit.UI {
|
||||||
} while (p != null);
|
} while (p != null);
|
||||||
|
|
||||||
if (next != null) {
|
if (next != null) {
|
||||||
rightText.ScrollToVerticalOffset(rightText.VerticalOffset + maxTop);
|
rightText.ScrollToVerticalOffset(rightText.VerticalOffset + maxTop - 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue