Fix selection printing
Needs ReviewPublic

Authored by hoffmannrobert on Fri, Jan 10, 1:40 PM.



Printing selected text only worked correctly if the lines from which text was
selected fit into single printed lines. Text selected from lines using multiple
printed lines was printed incompletely and/or additional text which wasn't
selected was printed.

This patch fixes printing text from long lines.

BUG: 415570

Test Plan
  1. Select text from one or more lines which do not fit into single printed lines.
  2. Print (Ctrl+P)
  3. Options: Print range: Selection; Print (preferably to a PDF file)
  4. Compare printed and selected text.
  5. Repeat steps 1 to 4: select and print different parts of the text. For example, first select all, then exclude text from selection from the end, then from the beginning, then from both end and beginning and reduce the selection gradually.

Diff Detail

R39 KTextEditor
No Linters Available
No Unit Test Coverage
Build Status
Buildable 20892
Build 20910: arc lint + arc unit
hoffmannrobert created this revision.Fri, Jan 10, 1:40 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptFri, Jan 10, 1:40 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
hoffmannrobert requested review of this revision.Fri, Jan 10, 1:40 PM

That looks already better: If a line is wrapped and on the same page, then only the selected text is printed. It seems there are still corner cases.

  1. Create a document with just one long line that wraps over two printed pages. I this case, I am not able to print only the selected text properly.
  2. Say you have a line that wraps over e.g. 5 visual lines. And you just want to print the visually wrapped line 4 and 5. Right now, the visual lines 1-3 are just empty, but still take place. Maybe it makes sense to omit fully empty lines completely?

Can you reproduce this? I know this is tricky, so I'd be fine with committing the code as is. Or are you willing to put more efforts into 1. and/or 2. ? :-)

In any case, this is already very much appreciated.

Yes, I am working on it. Now, I have a solution for 1, but 2 is more difficult to fix. Probably next week.

Cool! Thanks for taking care of this.