Merge branch 'develop' into diff-prev-next-change-616

This commit is contained in:
goran-w 2024-11-16 18:09:56 +01:00
commit 636be4a7a8
4 changed files with 23 additions and 25 deletions

View file

@ -32,7 +32,7 @@ jobs:
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v4 uses: actions/setup-dotnet@v4
with: with:
dotnet-version: 8.0.x dotnet-version: 9.0.x
- name: Configure arm64 packages - name: Configure arm64 packages
if: ${{ matrix.runtime == 'linux-arm64' }} if: ${{ matrix.runtime == 'linux-arm64' }}
run: | run: |

View file

@ -1,6 +1,6 @@
{ {
"sdk": { "sdk": {
"version": "8.0.0", "version": "9.0.0",
"rollForward": "latestMajor", "rollForward": "latestMajor",
"allowPrerelease": false "allowPrerelease": false
} }

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport> <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>App.manifest</ApplicationManifest> <ApplicationManifest>App.manifest</ApplicationManifest>
<ApplicationIcon>App.ico</ApplicationIcon> <ApplicationIcon>App.ico</ApplicationIcon>

View file

@ -542,11 +542,16 @@ namespace SourceGit.Views
firstLineIdx = index; firstLineIdx = index;
} }
if (firstLineIdx <= 1)
return;
var firstLineType = lines[firstLineIdx].Type; var firstLineType = lines[firstLineIdx].Type;
var prevLineType = lines[firstLineIdx - 1].Type;
var isChangeFirstLine = firstLineType != Models.TextDiffLineType.Normal && firstLineType != Models.TextDiffLineType.Indicator; var isChangeFirstLine = firstLineType != Models.TextDiffLineType.Normal && firstLineType != Models.TextDiffLineType.Indicator;
if (isChangeFirstLine) var isChangePrevLine = prevLineType != Models.TextDiffLineType.Normal && prevLineType != Models.TextDiffLineType.Indicator;
if (isChangeFirstLine && isChangePrevLine)
{ {
for (var i = firstLineIdx - 1; i >= 0; i--) for (var i = firstLineIdx - 2; i >= 0; i--)
{ {
var prevType = lines[i].Type; var prevType = lines[i].Type;
if (prevType == Models.TextDiffLineType.Normal || prevType == Models.TextDiffLineType.Indicator) if (prevType == Models.TextDiffLineType.Normal || prevType == Models.TextDiffLineType.Indicator)
@ -556,33 +561,23 @@ namespace SourceGit.Views
} }
} }
} }
else
var findChange = false;
for (var i = firstLineIdx - 1; i >= 0; i--)
{ {
var prevChangeEnd = -1; var prevType = lines[i].Type;
for (var i = firstLineIdx - 1; i >= 0; i--) if (prevType == Models.TextDiffLineType.Normal || prevType == Models.TextDiffLineType.Indicator)
{ {
var prevType = lines[i].Type; if (findChange)
if (prevType == Models.TextDiffLineType.None ||
prevType == Models.TextDiffLineType.Added ||
prevType == Models.TextDiffLineType.Deleted)
{
prevChangeEnd = i;
break;
}
}
if (prevChangeEnd <= 0)
return;
for (var i = prevChangeEnd - 1; i >= 0; i--)
{
var prevType = lines[i].Type;
if (prevType == Models.TextDiffLineType.Normal || prevType == Models.TextDiffLineType.Indicator)
{ {
ScrollToLine(i + 2); ScrollToLine(i + 2);
return; return;
} }
} }
else if (!findChange)
{
findChange = true;
}
} }
} }
@ -604,6 +599,9 @@ namespace SourceGit.Views
lastLineIdx = index; lastLineIdx = index;
} }
if (lastLineIdx >= lines.Count - 1)
return;
var lastLineType = lines[lastLineIdx].Type; var lastLineType = lines[lastLineIdx].Type;
var findNormalLine = lastLineType == Models.TextDiffLineType.Normal || lastLineType == Models.TextDiffLineType.Indicator; var findNormalLine = lastLineType == Models.TextDiffLineType.Normal || lastLineType == Models.TextDiffLineType.Indicator;
for (var idx = lastLineIdx + 1; idx < lines.Count; idx++) for (var idx = lastLineIdx + 1; idx < lines.Count; idx++)