On Thu, Nov 18, 2010 at 10:10:45AM +0100, Jean-Marc Lasgouttes wrote: > Le 17/11/2010 23:57, Enrico Forestieri a écrit : > >Anyway, now that I have your attention, what about the newline-in-math > >patch which is sitting in the pipe? For your convenience, I attach here > >the last version. I tried to check all dangerous newline usages which > >could lead to blank lines in math. > > It looks good, although, I would have done it in the other > direction: have a ::breakLine() that sends \n unless last character > was already a breakLine. this seems more intuitive to me.
This was something that I also considered, but it would need adding a lastchar member to the class to record what char was output last, whereas it is immediate checking for what comes next. On the other hand, I agree that this way you should not care about using pendingNewline instead of sticking a '\n' in the last position. Hmm... maybe the price of another member would be balanced by this convenience. > Also, I am not completely sure of the value of the bool argument of > pendingNewline. I was following the rule "always use the same style of the code around", and the code in the WriteStream class follows a xxx(true) and xxx(false) way of doing things, instead of the setxxx() unsetxxx() way. > Nevertheless, the patch can go in as it is. Let's see how much work would be following the breakLine() approach. -- Enrico