Small bug (assertion error) in PythonWin
tim.one at home.com
Mon May 7 01:29:28 CEST 2001
[posted and mailed]
> I never see it in IDLE, so I suspect the difference will be traced
> to how lines are getting sucked out of the underlying text widget.
> The Tk text widget *always* has a newline at the end of the buffer;
> if Scintilla's doesn't, then PythonWin's emulation of the Tk text
> cmds used by AutoIdent.py has to make it look like it does.
> Scintilla does not guarantee that there is a newline at the end of
> the buffer as one of Scintilla's goals is to faithfully store any
> file and not all files end with a newline. There could be a mode to
> pretend that there is always a newline at the end (and I think Mark
> has asked for this) but that looks quite messy to me.
I expect it's not messy for Tk because they're not pretending: there *is* a
newline at the end of the buffer, even a freshly created buffer before its
first use. So it's a simple invariant for them to maintain. Perhaps that
would be simpler for Scintilla too, via a mode flag on the buffer.
BTW, note that the C std allows implementations to require a terminating
newline on a text file (ditto to invent one if it isn't there), so if you're
doing any text mode C I/O your "faithfully store" is a crap shoot anyway
More information about the Python-list