enhance: add first/last buttons for block-nav, no wrapping (#1015) (#1016)

Added 2 new buttons (only visible in block-nav mode), with new icons and new (en_US) strings (First/Last Difference).
Implemented these new buttons, and disabled the automatic wrap-around for the prev/next buttons in block-nav mode.
This commit is contained in:
Göran W 2025-02-24 02:32:19 +01:00 committed by GitHub
parent 9ab602788a
commit fa4caa2186
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 127 additions and 3 deletions

View file

@ -101,12 +101,12 @@ namespace SourceGit.ViewModels
return (_current >= 0 && _current < Blocks.Count) ? Blocks[_current] : null;
}
public Block GotoNext()
public Block GotoFirst()
{
if (Blocks.Count == 0)
return null;
Current = (_current + 1) % Blocks.Count;
Current = 0;
return Blocks[_current];
}
@ -115,7 +115,29 @@ namespace SourceGit.ViewModels
if (Blocks.Count == 0)
return null;
Current = _current == -1 ? Blocks.Count - 1 : (_current - 1 + Blocks.Count) % Blocks.Count;
if (_current == -1)
Current = 0;
else if (_current > 0)
Current = _current - 1;
return Blocks[_current];
}
public Block GotoNext()
{
if (Blocks.Count == 0)
return null;
if (_current < Blocks.Count - 1)
Current = _current + 1;
return Blocks[_current];
}
public Block GotoLast()
{
if (Blocks.Count == 0)
return null;
Current = Blocks.Count - 1;
return Blocks[_current];
}