Bug 399278 - The highlights for the two trailing spaces in markdown documents unrecoverably disappear after changing an related option
Summary: The highlights for the two trailing spaces in markdown documents unrecoverabl...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-01 13:27 UTC by KLsz
Modified: 2019-02-24 17:04 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.57


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description KLsz 2018-10-01 13:27:19 UTC
WHAT SHOULD HAPPEN
In Markdown, two spaces at the end of a line means a line break. A newly installed Kate will show two underlines `__` indicating the two spaces.

WHAT HAS HAPPENED
The `__` render disappears unrecoverably after changing the option "Highlight trailing spaces". With that option, Kate will be able to render with a sizeable dot like `·` for a trailing space.

STEPS TO REPRODUCE
1. A newly installed Kate is required.
2. Create a file and save it as `filename.md` with contents below:
```
This is a line with two trailing spaces (two spaces here ->).  
The two trailing spaces means a line break (two spaces here ->).  
And this is a line without trailing spaces (no spaces here).
A raw line break in a Markdown file acts a space (no spaces here).
```
3. (EXPECTED RESULT) You will see the highlights like this:
```
This is a line with two trailing spaces (two spaces here ->).__
The two trailing spaces means a line break (two spaces here ->).__
And this is a line without trailing spaces (no spaces here).
A raw line break in a Markdown file acts a space (no spaces here).
```
4. Then tick the checkbox at Setting -> Configure Kate -> (left column) Editor Component -> Appearance -> (right column) Whitespace Highlighting -> Highlight trailing spaces. Apply your setting.
5. You will see the highlight like this:
```
This is a line with two trailing spaces (two spaces here ->).··
The two trailing spaces means a line break (two spaces here ->).··
And this is a line without trailing spaces (no spaces here).
A raw line break in a Markdown file acts a space (no spaces here).
```

Well, for now, it seems that Kate does well because it does render the trailing space with the dot as in the Settings.
BUT, if I want to switch back to the underline rendering, I find it UNRECOVERABLE.

6. Untick the checkbox at Setting -> Configure Kate -> (left column) Editor Component -> Appearance -> (right column) Whitespace Highlighting -> Highlight trailing spaces. Apply your setting.
7. (OBSERVED RESULT) You will find the highlights `__` disappear unrecoverably:
```
This is a line with two trailing spaces (two spaces here ->).  
The two trailing spaces means a line break (two spaces here ->).  
And this is a line without trailing spaces (no spaces here).
A raw line break in a Markdown file acts a space (no spaces here).
```

MY SPECULATION THAT MAY HELP

The `__` rendering is a part of language-specified highlights and the `·` rendering is a part of system-wide highlights. This two options are conflict with each other and adjusting the latter disables the former.

SOFTWARE VERSIONS
KDE Plasma Version: 5.12.6
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5

Thanks.
Comment 1 Ahmad Samir 2019-02-19 15:13:50 UTC
https://phabricator.kde.org/D19161
Comment 2 Christoph Cullmann 2019-02-24 17:04:52 UTC
Git commit 8fb410574b142207d88353ed712a5bd08440d08f by Christoph Cullmann, on behalf of Ahmad Samir.
Committed on 24/02/2019 at 17:06.
Pushed by cullmann into branch 'master'.

Use QTextFormat::TextUnderlineStyle instead of QTextFormat::FontUnderline

Summary:
QTextFormat::FontUnderline has been deprecated upstream for a long time.

It seems that for some time setting the underline attribute for syntax
highlighting has been broken, i.e. a user can't set it via the config
widget and setKateExtendedAttributeList always sets it to false. The
latter meant that when the user applied any changes that would write
katesyntaxhighlightingrc, the underline attribute for syntax HL would
unconditionally be set to false which leads to some weird situations,
(e.g. bug 399278 where un/setting "highlight trailing spaces" causes
katesyntaxhighlightingrc to get written to disk which leads to
Markdown:linebreak losing its underline attribute for good).
FIXED-IN: 5.57

Reviewers: #ktexteditor, cullmann, dhaumann

Reviewed By: #ktexteditor, cullmann

Subscribers: kde-frameworks-devel, kwrite-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D19161

M  +2    -2    src/schema/katestyletreewidget.cpp
M  +1    -1    src/syntax/katehighlight.cpp
M  +1    -1    src/syntax/katesyntaxmanager.cpp

https://commits.kde.org/ktexteditor/8fb410574b142207d88353ed712a5bd08440d08f