Monday, April 29, 2013

Error List Changes Finalized

The method of keeping a list of change operations does not work when multiple lines of the program are changed with more than one error affected because each line of the multiple line change is processed individually.  This caused errors will the same index to be repeatedly set leading to the many extra change operations being appended to the change list.  Even though this was a failed attempt, it did lead to a clue on how to get the start and end indexes of the changes method working correctly.

The index to the start of the changes only needs to be set the first time since a lower index will not be changed.  The index to the end of the changes will still be set if a higher index is changed, but with a slight modification.

The clue to the solution came from the debug output in the edit box receiving errors changed signal.  As the list of changes were processed, the debug code simply incremented the index for each change operation except for a remove operation.  The index was not incremented for a remove operation since an error was removed from the list and the next operation applied to the same index.

Therefore, before checking if end change index needs to be set to the current higher index, the index is decremented first for a remove operation.  The edit box will determines the number of errors that have changed by subtracting the start from the end index and adding one.  For example, for a single remove operation, the end index will be one less than the start index, so the number of errors changes will calculate to zero.  The number of errors removed (or inserted) is determined by the change in the size of the error list.

The debug output code in the edit box was updated to allow for an end index to be one less than the start index.  The code still outputs asterisks for errors that changed (because the index is within the start and end indexes of the changes), but now outputs a minus if no errors were changed (only removed).

[commit 9ea17018cc]

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)