BUGFIX: Fixed crash on some include file cases.
Reported by ETH students last year: if you include a file, where the file has an error in a line with a number higher than the original, the Python code crashes. This is a *patch* only because the real underlying problem is that error reporting does not take include commands into account, and does not propagate any file names.
This commit is contained in:
parent
9605d5e772
commit
feb3827ba1
@ -158,7 +158,21 @@ class EditorStc(Editor):
|
||||
def SetText(self, txt):
|
||||
self.control.SetText(txt)
|
||||
|
||||
def GetLineCount(self):
|
||||
""" Currently rather stupid, can probably be done more
|
||||
efficiently through some Scintilla function. """
|
||||
txt = self.GetText().splitlines()
|
||||
return len(txt)
|
||||
|
||||
def SetErrorLine(self,line):
|
||||
"""
|
||||
Currently this is BROKEN for include commands, as no file names
|
||||
are propagated. To minize the damage, we at least don't try to
|
||||
highlight non-existing names. In the long run of course
|
||||
propagation is the only way to handle this.
|
||||
"""
|
||||
if line <= self.GetLineCount():
|
||||
if line > 0:
|
||||
line = line - 1 # Start at 0 in stc, but on screen count is 1
|
||||
pos = self.control.GetLineIndentPosition(line)
|
||||
last = self.control.GetLineEndPosition(line)
|
||||
|
Loading…
Reference in New Issue
Block a user