Fix garbled output bug in `set $qsubscript`
The implementation of set $qsubscript
adds the new string (the rvalue) you want to set in to one of its first argument's namevalue
locations, followed by a ')' character, and the string terminator (\201) to the end of the new namevalue
it returns, in every situation. This should only be done when adding a new subscript to the end of the subscript list/tuple, even if it is adding to a position that is more than one beyond the current last subscript position. But in every other case, this should not be done.
I fixed this, by checking if the last namevalue
character written to the output buffer so far, was the ')', and if it was not, I left the current behavior alone, as it was correct; if it is the ')' character, the algorithm has already stored the new value earlier in the subscript list, so the loop to add it to the end, will no longer be executed, thus preventing the erroneous, garbled output.