mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
Improve navigation behavior
Prev/next at start/end of range now (re-)scrolls to first/last change-block (I.e when unset, or already at first/last change-block, or at the only one.) Current change-block is now unset in RefreshContent().
This commit is contained in:
parent
392ab5061e
commit
2edf01db3b
1 changed files with 16 additions and 2 deletions
|
@ -78,9 +78,15 @@ namespace SourceGit.ViewModels
|
||||||
if (_content is Models.TextDiff textDiff)
|
if (_content is Models.TextDiff textDiff)
|
||||||
{
|
{
|
||||||
if (textDiff.CurrentChangeBlockIdx > 0)
|
if (textDiff.CurrentChangeBlockIdx > 0)
|
||||||
|
{
|
||||||
textDiff.CurrentChangeBlockIdx--;
|
textDiff.CurrentChangeBlockIdx--;
|
||||||
else if (textDiff.CurrentChangeBlockIdx == -1 && textDiff.ChangeBlocks.Count > 0)
|
}
|
||||||
textDiff.CurrentChangeBlockIdx = 0; // Jump to first change block
|
else if (textDiff.ChangeBlocks.Count > 0)
|
||||||
|
{
|
||||||
|
// Force property value change and (re-)jump to first change block
|
||||||
|
textDiff.CurrentChangeBlockIdx = -1;
|
||||||
|
textDiff.CurrentChangeBlockIdx = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +95,15 @@ namespace SourceGit.ViewModels
|
||||||
if (_content is Models.TextDiff textDiff)
|
if (_content is Models.TextDiff textDiff)
|
||||||
{
|
{
|
||||||
if (textDiff.CurrentChangeBlockIdx < textDiff.ChangeBlocks.Count - 1)
|
if (textDiff.CurrentChangeBlockIdx < textDiff.ChangeBlocks.Count - 1)
|
||||||
|
{
|
||||||
textDiff.CurrentChangeBlockIdx++;
|
textDiff.CurrentChangeBlockIdx++;
|
||||||
|
}
|
||||||
|
else if (textDiff.ChangeBlocks.Count > 0)
|
||||||
|
{
|
||||||
|
// Force property value change and (re-)jump to last change block
|
||||||
|
textDiff.CurrentChangeBlockIdx = -1;
|
||||||
|
textDiff.CurrentChangeBlockIdx = textDiff.ChangeBlocks.Count - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue