Fix empty pages in print preview and lines printed twice
ClosedPublic

Authored by hoffmannrobert on Jun 3 2019, 3:07 PM.

Details

Summary

There were errors if a page's last line is too long and needs to be
wrapped into two or more lines:

  • The first line of the wrapped lines was printed correctly at the end of the page, but on the next page this first line was printed again.
  • In print preview the first wrapped line was shown correctly at the end of the page, but the next and following pages were empty.

Reasons:

  • remainder variable was always 0
  • clipping was not reset

BUG: 348598

Test Plan

In Kate, open a text file that has long lines. Check lines at page ends
which are wrapped to the next page. Check printing and print preview.

Diff Detail

Repository
R39 KTextEditor
Branch
fix_preview_and_printing
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12365
Build 12383: arc lint + arc unit
hoffmannrobert created this revision.Jun 3 2019, 3:07 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptJun 3 2019, 3:07 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
hoffmannrobert requested review of this revision.Jun 3 2019, 3:07 PM

No, that's something different. That is apparently a duplicate of https://bugs.kde.org/show_bug.cgi?id=391678 which is already fixed: https://phabricator.kde.org/D18163

Many years ago I also stumbled over this bug, and I know for sure it never was fixed. If this fix really works then this would be really great! That said I have not yet tried the patch but am positive to get this in soon!

ngraham edited the summary of this revision. (Show Details)Jun 23 2019, 9:05 PM
ngraham added reviewers: Kate, KTextEditor.

I tried to reproduce the issue with and without this fix but I somehow fail.
Has somebody else more luck?

I will test tomorrow ;)

I tried to reproduce the issue with and without this fix but I somehow fail.
Has somebody else more luck?

Try with long log files like boot.log, dmesg.log or journalctl output. Open print preview and scroll down. After some pages there will be only blank pages or just one or two lines of text at the end of a page.

dhaumann accepted this revision.Jun 29 2019, 8:18 PM

I just tested kwrite from master with Qt 5.12.0, and printing was completely broken. It even printed on Letter even though I specified A4 paper. A Qt update to Qt 5.12.3 fixed this - good so far.

Indeed I can reproduce the following: If I have a line that wraps to the next page, the line is printed twice. With this patch, it works!

This revision is now accepted and ready to land.Jun 29 2019, 8:18 PM
dhaumann closed this revision.Jun 29 2019, 8:29 PM

Fixed for KF 5.60 with commit 6bbbe6aa51c0a293a58dbca6223e37a73ce32122, thanks for the patch - keep it coming!

@hoffmannrobert: Are you maybe also interested in looking into https://bugs.kde.org/show_bug.cgi?id=415570 ? It's again about printing, this time about the very last line that seems to be wrong...

@hoffmannrobert: by the way, looking at your phabricator activity, you should get a KDE contributor account, if you don't have one already.

@hoffmannrobert: Are you maybe also interested in looking into https://bugs.kde.org/show_bug.cgi?id=415570 ? It's again about printing, this time about the very last line that seems to be wrong...

Yes, I can reproduce the bug. I'll look into it in about two weeks.

@hoffmannrobert: by the way, looking at your phabricator activity, you should get a KDE contributor account, if you don't have one already.

I applied for one and added you as a supporter, thanks.

@hoffmannrobert: Are you maybe also interested in looking into https://bugs.kde.org/show_bug.cgi?id=415570 ? It's again about printing, this time about the very last line that seems to be wrong...

Yes, I can reproduce the bug. I'll look into it in about two weeks.

See https://phabricator.kde.org/D26560