IDs of deleted shapes still written to PointsToNoteIDs list in Scapple XML

A small bug in the XML (.scap file) which Scapple writes out.

If we add a new shape to an existing diagram, perhaps after a few shape deletions, so that its ID is the highest in the document, and not contiguous to others, we might create something like this in the .scap file:

Screen Shot 2018-06-19 at 17.21.16.png

<Note ID="34" FontSize="12.0" Position="628.167045,186.799347" Width="91.0"> <Appearance> <Alignment>Left</Alignment> </Appearance> <String>Supernumerary</String> <ConnectedNoteIDs>6</ConnectedNoteIDs> </Note>

and the in the PointsToNoteIDs list of the shape which points to it, its ID (34 in this example) will also appear:

<Note ID="6" FontSize="12.0" Position="505.0,78.0" Width="73.0"> <Appearance> <Alignment>Left</Alignment> </Appearance> <String>composition</String> <ConnectedNoteIDs>5, 7-8, 10, 34</ConnectedNoteIDs> <PointsToNoteIDs>7-8, 10, 34</PointsToNoteIDs> </Note>

So far so good, however if we then delete the new shape, and save the Scapple file,
it turns out that its ID continues to appear in the PointsToNoteIDs list of the other shape, even though that ID:

  • no longer corresponds to any actual shape in the diagram and
  • has been successfully purged from the ConnectedNodeIDs value.

<Note ID="6" FontSize="12.0" Position="505.0,78.0" Width="73.0"> <Appearance> <Alignment>Left</Alignment> </Appearance> <String>composition</String> <ConnectedNoteIDs>5, 7-8, 10</ConnectedNoteIDs> <PointsToNoteIDs>7-8, 10, 34</PointsToNoteIDs> </Note>

A minor bug in the sense that it doesn’t seem to trip up Scapple itself,
but it did initially trip up a script which parsed the XML, and found:

  • a reference to a shape which didn’t exist, and
  • an ID in the PointsToNoteIDs list which didn’t show up in the corresponding ConnectedNoteIDs list.

That I can reproduce. It looks to be as simple as this:

  1. Create a new blank board.
  2. Press ⌘↩ to create a new note.
  3. Use Notes ▸ New Background Shape.
  4. ⌥⌘-drag the new shape onto the note.
  5. Delete the shape.
  6. Save and examine XML.


<Notes> <Note ID="0" FontSize="14.0" Position="324.0,168.333333" Width="200.0"> <Appearance> <Alignment>Left</Alignment> <Border Style="Square"></Border> </Appearance> <String>Test Note</String> <PointsToNoteIDs>1</PointsToNoteIDs> </Note> </Notes>