Bug 440089 - python syntax highlighting breaks with binary strings
Summary: python syntax highlighting breaks with binary strings
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 21.04.3
Platform: Manjaro Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-20 23:41 UTC by shawn
Modified: 2021-07-25 19:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
screenshot of issue (33.33 KB, image/png)
2021-07-20 23:41 UTC, shawn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description shawn 2021-07-20 23:41:47 UTC
Created attachment 140221 [details]
screenshot of issue

SUMMARY
Binary string highlighting affects the entire file after the string ends.
So if strings are highlighted red, typing `b"test"` will cause all text after that to appear red
note that the code runs as expected, so its not a syntax error


STEPS TO REPRODUCE
1. Open python file in kate
2. Add a line like print(b"test") to the file

OBSERVED RESULT
All text after the binary string is highlighted the same color as the string (changing the color doesn't affect the bug)

EXPECTED RESULT
the color should revert back to normal after closing quote

SOFTWARE/OS VERSIONS 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
note that I am using Qtile as a standalone WM but still have a full KDE environment installed but not in use.
Comment 1 Jan Paul Batrina 2021-07-21 15:24:52 UTC
Hello, thanks for the bug report!

This will be fixed if https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/227 is merged
Comment 2 shawn 2021-07-22 14:29:17 UTC
(In reply to Jan Paul Batrina from comment #1)
> Hello, thanks for the bug report!
> 
> This will be fixed if
> https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/227
> is merged

cool thanks!
Comment 3 Christoph Cullmann 2021-07-25 19:04:07 UTC
Git commit 332a63e860f90544bc83dca69e851170b1f8d464 by Christoph Cullmann, on behalf of Jan Paul Batrina.
Committed on 25/07/2021 at 19:03.
Pushed by cullmann into branch 'master'.

Python: Fix single quote bytes literals (b"")

In the bytes literal regexes, \x27 (') was excluded
instead of \x22 ("), which made the literal unable
to terminate.

New tests were added to test this case.

M  +2    -0    autotests/folding/test.py.fold
M  +2    -0    autotests/html/test.py.dark.html
M  +2    -0    autotests/html/test.py.html
M  +2    -0    autotests/input/test.py
M  +2    -0    autotests/reference/test.py.ref
M  +3    -3    data/syntax/python.xml

https://invent.kde.org/frameworks/syntax-highlighting/commit/332a63e860f90544bc83dca69e851170b1f8d464