fix a crash if you try to use back/forward from a search tab.

This commit is contained in:
Benjamin Popp
2019-01-15 21:50:00 -06:00
parent 62ddff0e30
commit 02a8edd4ef
2 changed files with 16 additions and 9 deletions

View File

@@ -55,15 +55,15 @@ namespace HavenSoft.Gen3Hex.Core.ViewModels {
}
public string Name { get; }
public string FileName => string.Empty;
public ICommand Save => null;
public ICommand SaveAs => null;
public ICommand Undo => null;
public ICommand Redo => null;
public ICommand Copy => null;
public ICommand Clear => null;
public ICommand Goto => null;
public ICommand Back => null;
public ICommand Forward => null;
public ICommand Save { get; } = new StubCommand();
public ICommand SaveAs { get; } = new StubCommand();
public ICommand Undo { get; } = new StubCommand();
public ICommand Redo { get; } = new StubCommand();
public ICommand Copy { get; } = new StubCommand();
public ICommand Clear { get; } = new StubCommand();
public ICommand Goto { get; } = new StubCommand();
public ICommand Back { get; } = new StubCommand();
public ICommand Forward { get; } = new StubCommand();
public ICommand Close => close;
public IModel Model => null;

View File

@@ -142,6 +142,13 @@ namespace HavenSoft.Gen3Hex.Tests {
Assert.Equal("000A00", viewPort.Headers[0]);
}
[Fact]
public void CannotBackFromSearchTab() {
var searchTab = new SearchResultsViewPort("bob");
Assert.False(searchTab.Back.CanExecute(null));
Assert.False(searchTab.Forward.CanExecute(null));
}
[Fact]
public void BackRecallsYourLastScrollPosition() {
var viewPort = new ViewPort(new LoadedFile("test.txt", new byte[0x1000])) { Width = 0x10, Height = 0x10 };