@shadow - bug when refreshing from modified public file

2 views
Skip to first unread message

Nick_H

unread,
Jul 23, 2010, 10:59:42 AM7/23/10
to leo-editor
I'm working with Leo 4.7.1 final (build 3005, dated 26 Feb 2010) and
just noticed a bug in propagate_changed_lines within leoShadow.py.
I haven't worked out the complete fix for this, but thought I'd
mention it now so that others don't stumble over it unawares.
It's the handling of the 'replace' tag (new code dated 7 Jan 2010)
which does not handle the case when the number of new lines is
different from the number of old lines. In fact the number of new
lines can be either greater or less than the number of old lines, so
the code needs a little more complexity to deal with this. Currently
it only replaces the same number of lines as were in the old file.
There's an added twist in that if sentinels occur in the middle of the
old lines, it won't be clear how to distribute the new lines on either
side of the sentinels.
I'll comment further when I've thought about this some more, but for
now, this is just a road cone to mark the spot.

Best regards

Nick

Nick_H

unread,
Jul 23, 2010, 11:24:00 AM7/23/10
to leo-editor
After a little more thought, I suspect that the simple approach is
likely to be the best, at least initially.
I'd suggest placing a condition (if new_public_lines_rdr.index() <
new_j) on the copying of new public lines to new private lines, then
finishing off with a loop copied from the 'insert' tag above -- (while
new_public_lines_rdr.index() < new_j ...).

I'm not in a position to get involved with direct editing of the code
within SourceForge, but I contribute these thoughts in the hope that
an active contributor may be able to make something of them.

Best regards, again

Nick
Reply all
Reply to author
Forward
0 new messages