Bug 415570

Summary: Print > Selection omits some text
Product: [Applications] kate Reporter: Nicolás Adamo <nicoadamo>
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: cullmann, justin.zobel, nate, nck, nicoadamo
Priority: NOR    
Version: 19.12.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: The result of the bug I'm trying to describe.
Selected Text
Printed Text
Source Text

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!