Am Samstag, 30. Juni 2007 22:10 schrieb Dov Feldstern: > Okay, thanks for the explanation. That part is really the only part that > I changed only because it didn't look right, and not because I saw an > actual bug that it fixes. It may still be a good idea to leave it in, so > that there really is as little difference as possible between "default" > and "auto", which makes it easier to debug. Does that sound reasonable?
Both versions are fine with me. > The other fix, though, you agree is necessary? Which one do you mean? > the 'count' is returned from switchEncoding, and is a count of how many > additional characters have been added to the latex file. In > switchEncoding, these added characters are exactly those of the > \inputencoding command. If there was no encoding switch, the count is 0; > the reverse, however, is *not* correct: there may have been an encoding > switch, and the count is still 0: if we're not outputting the encoding > switch commands, as is the case with "default". However, Paragraph.cpp > is currently assuming that if count is 0, then the encoding was not > switched, and therefore is not resetting the runparams.encoding; Now I understand. This is a thinko of mine. > but as > I have shown, with "default" encoding, there are situations when > runparams.encoding should be updated, even though the count is 0, and > that's what this patch does. Maybe I should add a comment explaining this? That would put knowledge about the switchEncoding internals into the caller. That is dangerous, because the internals might change. I would prefer to be explicit: Let switchEncoding return a std::pair<bool, int>. The bool would return whether the encoding was changed, and this could be tested explicitly instead of the count. > To be sure, I am now updating the runparams.encoding even when the > encoding has not switched, but I don't think that that really matters... I can confirm that the result is correct, but nevertheless I'd prefer a different solution (see above). Georg