GNOME Bugzilla – Bug 344038
broken syntax highlighting -- triple single quotes strings not properly coloured
Last modified: 2006-06-06 17:21:54 UTC
Please describe the problem: Python supports multiple-line strings, which are specified by enclosing with triple single quotes '''like so''' or triple-double """like so""". The syntax highlighting is broken for multi-lined triple single quote strings, in that only the first line has the syntax highlighting colour for strings. Subsequent lines are highlighted as though they were in-line code, not as though they were part of a string. Some examples to clarify: <Python code> """This is a multi-line string with triple double quotes and gedit 2.14.3 colours both lines with the colour for strings, as desired.""" '''This is a multi-line string with triple single quotes and gedit 2.14.3 does NOT colour all lines with the colour for strings. Instead, only the first line is given the string colour, and all the subsequent lines are coloured as though they were inline code (i.e. 'for', 'is' and other keywords are coloured and most words are normal black text.)''' '''In this triple-single quote string, the first line is highlighted, as a string and the second is not. But, what is even more strange is that everything after the run of double quotes here --> """ is highlighted. This includes any code after the present string and thus after its closing triple single quotes. (Up until another occurence of triple double quotes, anyway.) Given that they occur inside a triple single quote string, the triple double quotes a few lines up ought not be interpreted as starting a new string.''' #This is still highlighted like a string, not like a comment, as desired. </Python code> This may be related to bug 340354. However, I made sure that all of the lines in the above examples ended with line feed characters, not carriage returns or both. Steps to reproduce: 1. Snip the given examples and save them into a file with the .py extension. 2. View the code in gedit. 3. View the code in IDLE, the lightweight Python IDE that ships with Python. (IDLE will only hightlight the code if the filename ends with .py or .pyw.) 4. Observe manifest difference and conclude gedit's colouring engine isn't working as desired. Actual results: Syntax colouring is defective in gedit as described. Expected results: All triple quoted strings should be coloured as strings (as they are by IDLE, modulo difference of colour choice). Does this happen every time? Yes. Other information: gedit 2.14.3, ubunutu 6.06.
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of 139267 ***
Sorry for the dupe. I did search, but obviously not well enough :-)