don't copy text for splitter segments

these have no data and are purely for modeling
This commit is contained in:
Haven1433 2022-08-29 20:49:59 -05:00
parent ce27bdcd53
commit c79652d2fd
2 changed files with 17 additions and 4 deletions

View File

@ -122,10 +122,12 @@ namespace HavenSoft.HexManiac.Core.Models.Runs {
text.Append($"{ViewPort.CommentStart}{names[i]}{ViewPort.CommentStart}, ");
}
text.Append(segment.ToText(data, offset, deep).Trim());
if (j + 1 < self.ElementContent.Count) text.Append(", ");
offset += segment.Length;
length -= segment.Length;
if (segment.Length > 0) {
text.Append(segment.ToText(data, offset, deep).Trim());
if (j + 1 < self.ElementContent.Count) text.Append(", ");
offset += segment.Length;
length -= segment.Length;
}
}
if (i + 1 < self.ElementCount) text.Append(Environment.NewLine);
offsets = new ArrayOffset(i + 1, 0, offset, 0);

View File

@ -1115,6 +1115,17 @@ namespace HavenSoft.HexManiac.Tests {
Assert.Equal(3, Model[0x20]);
}
[Fact]
public void TableWithSplitterSegment_Copy_SplitterSegmentNotCopied() {
ViewPort.Edit("^table[a:: b:: | c:: d::]3 ");
ViewPort.SelectionStart = new(4, 1);
ViewPort.SelectionEnd = new(11, 1);
ViewPort.Copy.Execute(FileSystem);
Assert.Equal("0, 0,", FileSystem.CopyText.value.Trim());
}
private void ArrangeTrainerPokemonTeamData(byte structType, byte pokemonCount, int trainerCount) {
CreateTextTable(HardcodeTablesModel.PokemonNameTable, 0x180, "ABCDEFGHIJKLMNOP".Select(c => c.ToString()).ToArray());
CreateTextTable(HardcodeTablesModel.MoveNamesTable, 0x1B0, "qrstuvwxyz".Select(c => c.ToString()).ToArray());