Bug 415570 - Print > Selection omits some text
Summary: Print > Selection omits some text
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: 19.12.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-26 03:29 UTC by Nicolás Adamo
Modified: 2024-08-02 20:54 UTC (History)
5 users (show)

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


Attachments
The result of the bug I'm trying to describe. (3.99 KB, text/plain)
2019-12-26 03:29 UTC, Nicolás Adamo
Details
Selected Text (415.92 KB, image/png)
2022-01-09 16:35 UTC, Nicolás Adamo
Details
Printed Text (15.91 KB, application/pdf)
2022-01-09 16:35 UTC, Nicolás Adamo
Details
Source Text (8.26 KB, text/plain)
2022-01-09 16:36 UTC, Nicolás Adamo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolás Adamo 2019-12-26 03:29:43 UTC
Created attachment 124718 [details]
The result of the bug I'm trying to describe.

SUMMARY
The Print menu, with option "Selection" triggers the printer, but one line in the paper is trimmed. It's wired. No special characters other than " (quotes), Spanish accents like 'ú' and one '!'.

STEPS TO REPRODUCE
1. Open a text file in Kate with final line as the following:
-Lo anterior va de la mano con el comentario de Nicole Jeldres "Eres súper exigente contigo mismo, y con los demás!".
2. Select the final line and then File > Print or Ctrl+P.
3. Selection.
4. Print button.

OBSERVED RESULT
It's on a paper. I could show some photo if you require, but the attached PDF was generated with the same result.

EXPECTED RESULT
The full line printed.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Justin Zobel 2020-10-30 02:28:42 UTC
I can confirm odd issues with this as well.

I printed the line in step 1 as part of another document but it printed only part of the sentence (removing some parts in the middle).
Comment 2 Christoph Cullmann 2022-01-09 12:29:52 UTC
Hmm, for me this prints just the full selected line to the PDF, at least with Kate 21.12 & Frameworks 5.89.

Can you reproduce it with a fresh version?
Comment 3 Nicolás Adamo 2022-01-09 16:35:30 UTC
Created attachment 145270 [details]
Selected Text
Comment 4 Nicolás Adamo 2022-01-09 16:35:59 UTC
Created attachment 145271 [details]
Printed Text
Comment 5 Nicolás Adamo 2022-01-09 16:36:26 UTC
Created attachment 145272 [details]
Source Text
Comment 6 Nicolás Adamo 2022-01-09 16:38:03 UTC
I've just tested Kate version 21.12.1
It stills performs wrong, or not as expected.

Regards,

Nicolás Adamo
Comment 7 Sarah Wong 2022-10-17 04:24:17 UTC
This problem seems to be because the logic to clip individual lines to selection doesn't work properly when there is a line wrap in the printed document:

https://invent.kde.org/frameworks/ktexteditor/-/blob/4594c7e66df9325ef2dd256af75bbe9cf3b06398/src/printing/printpainter.cpp#L650-661
Comment 8 Christoph Cullmann 2023-08-17 17:50:04 UTC
Help to fix that would be welcome!
Comment 9 Bug Janitor Service 2024-08-02 18:47:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/712
Comment 10 Christoph Cullmann 2024-08-02 20:54:16 UTC
Git commit cbd7210df6d5dff2e6197c1dec224b8f7870ad4f by Christoph Cullmann, on behalf of Waqar Ahmed.
Committed on 02/08/2024 at 20:44.
Pushed by cullmann into branch 'master'.

Fix selection printing

Personally I think clipping away selection like this is a poor way to
handle selection during printing. It would be better if we instead only
layout the selected part of the text and paint that just.

M  +15   -3    src/printing/printpainter.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/cbd7210df6d5dff2e6197c1dec224b8f7870ad4f