Bug 482078

Summary: In a list item the first character after a newline is incorrectly highlighted as a list number
Product: [Applications] ghostwriter Reporter: pirateclip
Component: generalAssignee: megan.conkle
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 23.08.4   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Both 1 and X highlighted on classic theme
Both 1 and X highlighted on plainstraction theme
The same text in the preview window

Description pirateclip 2024-02-29 19:11:46 UTC
Created attachment 166212 [details]
Both 1 and X highlighted on classic theme

SUMMARY
In a List Item the First Character After a newline is incorrectly highlighted as a list number

STEPS TO REPRODUCE
1) Open a new markdown file with ghostwriter
2) Type the following into the file:
1. T
X

OBSERVED RESULT
Both the 1 and X are highlighted

EXPECTED RESULT
Only the 1 is highlighted as X is not a new list item

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12
openSUSE Tumbleweed Release: 20240227

ADDITIONAL INFORMATION
This happens on both the Classic and Plainstraction themes
Comment 1 pirateclip 2024-02-29 19:12:15 UTC
Created attachment 166213 [details]
Both 1 and X highlighted on plainstraction theme
Comment 2 pirateclip 2024-03-03 06:08:42 UTC
Created attachment 166329 [details]
The same text in the preview window

The X in this example should instead be counted as being a part of the same list item as the 1.
The preview window correctly determines this as the text appears as:
1. T X

Where the X is in the same list item as the T.
Comment 3 megan.conkle 2024-07-07 01:39:52 UTC
Git commit ce0ff54cd800db0acc75e496f8789fea72f22ba5 by Megan Conkle.
Committed on 07/07/2024 at 01:38.
Pushed by wereturtle into branch 'master'.

Fix syntax highlighting with unicode characters

Applied yet another hacky fix to the syntax highlighting issue that keeps
cropping up with various combinations of unicode characters. Cross your fingers!

Also noticed a few other bugs happened to be fixed either by this change
or by previous refactoring during the port to Qt6.
Related: bug 487636, bug 475234, bug 485691

M  +5    -1    .gitignore
M  +3    -0    CHANGELOG.md
M  +2    -7    src/editor/markdowneditor.cpp
M  +70   -6    src/editor/markdownhighlighter.cpp
M  +3    -6    src/markdown/cmarkgfmapi.cpp
M  +2    -2    src/markdown/markdownnode.cpp
M  +15   -6    src/markdown/markdownnode.h
A  +604  -0    widgets.qss

https://invent.kde.org/office/ghostwriter/-/commit/ce0ff54cd800db0acc75e496f8789fea72f22ba5