D26560: Fix selection printing
hoffmannrobert added a comment. In case my last comment was mistakable, I fixed this: > 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. but I couldn't fix this: > 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? REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D26560 To: hoffmannrobert, dhaumann Cc: cullmann, kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, sars, dhaumann
D26560: Fix selection printing
hoffmannrobert added a comment. Here is the fix for 1. I've tried number 2, but I didn't get anywhere. I think this would need huge efforts: To remove the empty space before (and after) the selection you would have to change the layout, which is tied to the document, so basically you would have to change the document. And after that, all the regions which mask the parts (not) to be printed would have to be calculated in different ways. Please correct me if I'm wrong. I don't think the space saving is worth the effort, and I couldn't justify it to my sponsor. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D26560 To: hoffmannrobert, dhaumann Cc: cullmann, kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, GB_2, domson, michaelh, ngraham, bruns, demsking, sars, dhaumann
D26560: Fix selection printing
hoffmannrobert updated this revision to Diff 74577. hoffmannrobert added a comment. - Fix 1: long lines wrapping over pages REPOSITORY R39 KTextEditor CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D26560?vs=73197&id=74577 BRANCH fix_selection_printing REVISION DETAIL https://phabricator.kde.org/D26560 AFFECTED FILES src/printing/printpainter.cpp To: hoffmannrobert, dhaumann Cc: cullmann, kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, GB_2, domson, michaelh, ngraham, bruns, demsking, sars, dhaumann
D26560: Fix selection printing
cullmann added a comment. Cool! Thanks for taking care of this. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D26560 To: hoffmannrobert, dhaumann Cc: cullmann, kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, GB_2, domson, michaelh, ngraham, bruns, demsking, sars, dhaumann
D26560: Fix selection printing
hoffmannrobert added a comment. Yes, I am working on it. Now, I have a solution for 1, but 2 is more difficult to fix. Probably next week. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D26560 To: hoffmannrobert, dhaumann Cc: kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D26560: Fix selection printing
dhaumann added a comment. 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. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D26560 To: hoffmannrobert, dhaumann Cc: kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D26560: Fix selection printing
hoffmannrobert added a reviewer: dhaumann. REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D26560 To: hoffmannrobert, dhaumann Cc: kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
D26560: Fix selection printing
hoffmannrobert created this revision. Herald added projects: Kate, Frameworks. Herald added subscribers: kde-frameworks-devel, kwrite-devel. hoffmannrobert requested review of this revision. REVISION SUMMARY 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. REPOSITORY R39 KTextEditor BRANCH fix_selection_printing REVISION DETAIL https://phabricator.kde.org/D26560 AFFECTED FILES src/printing/printpainter.cpp To: hoffmannrobert Cc: kwrite-devel, kde-frameworks-devel, LeGast00n, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann