Lars Gullik Bjønnes wrote:

> What are the benefits of doing this now. Why cannot this wait?

  It fixes a class of dormant bugs. Everytime we examine the header files we
are looking in to the preamble and we risk to change it accidentally. This
is serious and a blocker to me.
  I had to fix several bugs before related with this code, now instead of
fixing some more I fixed the root of the problems.

  Yes, I have tested the code and I have verified that it works as it
should. :-)

  In this particular case the fix is easy and elegant, and it is in the same
spirit of lyx2lyx.

> | +            # remove end of line char(s)
> | +            if line[-2:-1] == '\r':
> | +                line = line[:-2]
> | +            else:
> |                  line = line[:-1]
> 
> rstrip('\r\n', line)

  Oh yes, but that does not handle the case where the line simply ends with
\n or \r...

  And no, if we open the file with mode "rb" it is not enough to guarantee
that we take care of every end of line cases.

  It happened before that lyx files created in other platforms still have
the wrong line termination so we simply want to play safe here.

  The code is the same in the three places where we call it so we could
create a free standing function to deal with it.

def strip_eol(line):
    # remove end of line char(s)
    if line[-2:-1] == '\r':
        return line[:-2]
    else:
        return line[:-1]

> or do the strip functions not exist in 1.5.3?

  The latest 1.5 is 1.5.2 :-) and the string modules does have the strip
functions there. The problems that we try to solve are others as I have
shown above.

-- 
José Matos

Reply via email to