Bug 474690 - incorrect scroll position after paste
Summary: incorrect scroll position after paste
Status: REPORTED
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: 22.08.2
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-19 13:16 UTC by kdebugs
Modified: 2023-09-19 13:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
example of data to paste which reproduces the bug (12.56 KB, text/plain)
2023-09-19 13:16 UTC, kdebugs
Details
screenshot of bug (example 1) (77.97 KB, image/png)
2023-09-19 13:17 UTC, kdebugs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kdebugs 2023-09-19 13:16:37 UTC
Created attachment 161719 [details]
example of data to paste which reproduces the bug

SUMMARY
The scroll position seems to be incorrectly calculated when pasting data.
These three things should always be true, but aren't always:
1) If a document contains enough text to require vertical scrolling, then there should always be less than one line of space below the last line (above the status bar).
2) If the data to paste contains enough text that vertical scrolling is necessary, then pasting should result in the cursor being at the bottom of the text area, just above the status bar.
3) After pasting, the cursor should always be scrolled into view.


STEPS TO REPRODUCE
1. Open the attached file, select all (Ctrl+A) and copy (Ctrl+C).
2. Open a new document (Ctrl+N).
3. Set Kate to use font "Hack" regular size 10.0, 1.0 line height.  Make sure the window size fits 153 columns x 34 lines (for me, maximized window on a 1366x768 screen).
4. Paste the data (Ctrl+V).

OBSERVED RESULT
There is extra space (about one and a half lines worth) under the last line (104), as though it scrolled past the end of the file.

EXPECTED RESULT
The last line should be at the bottom of the text area.

Also:
same thing, but with the window a few pixels shorter vertically
Observed result:
Last visible line at scroll position is the next to last line (103), thus cursor is not visible.

When you move to a different line or go do something else, the scroll position fixes itself.

Reproducible:
Always

Observed on:
Kubuntu 22.10
Qt version 5.15.6
KDE Frameworks version 5.98.0
Comment 1 kdebugs 2023-09-19 13:17:41 UTC
Created attachment 161720 [details]
screenshot of bug (example 1)