Found and fixed a bug in find/replace
Posted by mholmes on 25 Apr 2008 in Activity log
The TIMTDoc.FindNext
routine had an endless-loop bug caused by failure to detect wrapping around correctly (in other words, having searched the whole document and got back to the starting point without a result, it should have noticed that and stopped, but it didn't). It was caused by a failure to set the ItemIndex field to -1 when wrapping back around to the teiHeader
; the teiHeader
doesn't use ItemIndex
, because there's only one of it (as opposed to annotations or categories), so I was neglecting to set that field at all, but the test for wraparound depends on both the field type and the item index being the same as the starting point, so it does need to be set to -1. Fixed it.