mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-05-21 04:38:05 -05:00
Clip leading 0x off gotos
This commit is contained in:
parent
c25cac9811
commit
ae2947087b
|
|
@ -136,6 +136,7 @@ namespace HavenSoft.HexManiac.Core.ViewModels {
|
|||
var address = args.ToString().Trim();
|
||||
if (address.StartsWith(PointerRun.PointerStart.ToString())) address = address.Substring(1);
|
||||
if (address.EndsWith(PointerRun.PointerEnd.ToString())) address = address.Substring(0, address.Length - 1);
|
||||
if (address.StartsWith("0x")) address = address.Substring(2);
|
||||
var anchor = this.model.GetAddressFromAnchor(new ModelDelta(), -1, address);
|
||||
using (ModelCacheScope.CreateScope(this.model)) {
|
||||
if (anchor != Pointer.NULL) {
|
||||
|
|
|
|||
|
|
@ -361,6 +361,17 @@ namespace HavenSoft.HexManiac.Tests {
|
|||
Assert.Contains("| 4 bytes selected", test.ViewPort.SelectedAddress);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanPrefixAddressWith0xDuringGoto() {
|
||||
var editor = new EditorViewModel(new StubFileSystem());
|
||||
var test = new BaseViewModelTestClass();
|
||||
editor.Add(test.ViewPort);
|
||||
|
||||
editor.GotoViewModel.Goto.Execute("0x0030");
|
||||
|
||||
Assert.Equal(0x30, test.ViewPort.DataOffset);
|
||||
}
|
||||
|
||||
private void StandardSetup(out byte[] data, out PokemonModel model, out ViewPort viewPort) {
|
||||
data = Enumerable.Repeat((byte)0xFF, 0x200).ToArray();
|
||||
model = new PokemonModel(data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user