After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 344038 - broken syntax highlighting -- triple single quotes strings not properly coloured
broken syntax highlighting -- triple single quotes strings not properly coloured
Status: RESOLVED DUPLICATE of bug 139267
Product: gtksourceview
Classification: Platform
Component: Syntax files
1.6.x
Other All
: Normal minor
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2006-06-06 17:08 UTC by Brian van den Broek
Modified: 2006-06-06 17:21 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14



Description Brian van den Broek 2006-06-06 17:08:24 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.
Comment 1 Steve Frécinaux 2006-06-06 17:15:20 UTC
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 ***
Comment 2 Brian van den Broek 2006-06-06 17:21:54 UTC
Sorry for the dupe. I did search, but obviously not well enough :-)