Bug 509784 - Saving output as HTML cause multi-line text loses style
Summary: Saving output as HTML cause multi-line text loses style
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (other bugs)
Version First Reported In: 25.04.2
Platform: Debian stable Linux
: NOR minor
Target Milestone: ---
Assignee: Konsole Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-22 14:13 UTC by gwdx
Modified: 2025-10-11 01:25 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
In the HTML file, subsequent lines lack styling. (9.18 KB, image/png)
2025-09-22 14:13 UTC, gwdx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gwdx 2025-09-22 14:13:43 UTC
Created attachment 185153 [details]
In the HTML file, subsequent lines lack styling.

SUMMARY
When consecutive lines share the same style, the original implementation only applied a <span> to the first line, causing later lines to be rendered without the intended style.

STEPS TO REPRODUCE
1. Use the following command to print a long blue line in Konsole:
  ```
  for i in {1..500}; do echo -ne "\e[34m1\e[0m"; done
  ```
2. Use "Save Output As" to export the output as an HTML file.
3. Open the exported HTML file. 

OBSERVED RESULT
In the HTML file, only the first line is blue. Subsequent lines lack styling.

EXPECTED RESULT
All lines have blue style.

SOFTWARE/OS VERSIONS
Linux: Debian GNU/Linux 13
KDE Plasma Version: 6.3.6
KDE Frameworks Version: 6.13.0
Qt Version: 6.8.2
Comment 1 Bug Janitor Service 2025-09-22 14:24:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/1130
Comment 2 Christoph Cullmann 2025-10-11 01:25:15 UTC
Git commit b04c4ec523fa2c1807dd711d3612b495134f3784 by Christoph Cullmann, on behalf of Wendi Gan.
Committed on 10/10/2025 at 17:31.
Pushed by cullmann into branch 'master'.

HTMLDecoder: fix missing span on subsequent lines

Issue:
When saving output as HTML, for multiple lines with the same style, only the first line had a `<span>`, while subsequent lines lack styling.

Change:
For the first character, if there is no style change, apply the stored `_style`.

M  +5    -2    src/decoders/HTMLDecoder.cpp
M  +1    -0    src/decoders/HTMLDecoder.h

https://invent.kde.org/utilities/konsole/-/commit/b04c4ec523fa2c1807dd711d3612b495134f3784