After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 742933 - Overlay scrollbar makes editing last line of file difficult
Overlay scrollbar makes editing last line of file difficult
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: editor
unspecified
Other Linux
: Normal minor
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on: 92458
Blocks:
 
 
Reported: 2015-01-14 18:59 UTC by Michael Catanzaro
Modified: 2015-12-22 00:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add bottom margin to prevent hiding the last line (1.23 KB, patch)
2015-11-05 00:04 UTC, Joaquim Rocha
none Details | Review
Remove the theme's bottom padding (962 bytes, patch)
2015-11-05 00:05 UTC, Joaquim Rocha
committed Details | Review
Scroll beyond the last line leaving only this last line visible (3.08 KB, patch)
2015-11-05 22:17 UTC, Joaquim Rocha
none Details | Review
Scroll beyond the last line leaving only this last line visible (3.08 KB, patch)
2015-11-05 22:21 UTC, Joaquim Rocha
none Details | Review
Implement overscroll (4.79 KB, patch)
2015-11-20 21:13 UTC, Joaquim Rocha
committed Details | Review
Add settings' schema and bind function for the overscroll (2.04 KB, patch)
2015-11-20 21:14 UTC, Joaquim Rocha
committed Details | Review
editor: Add settings schema and bind for "overscroll" (2.09 KB, patch)
2015-12-22 00:04 UTC, Christian Hergert
committed Details | Review
source-view: Use bottom margin to scroll beyond the last line (4.78 KB, patch)
2015-12-22 00:04 UTC, Christian Hergert
committed Details | Review

Description Michael Catanzaro 2015-01-14 18:59:11 UTC
The new overlay scrollbar in GTK+ master makes editing the final line of files rather difficult. If you restrict yourself to the keyboard, it's OK, but trying to select text or position the cursor with the mouse causes the scrollbar to appear on top of the text. Not sure what to do about this....
Comment 1 Igor Gnatenko 2015-01-18 14:46:26 UTC
I agree, but this should be fixed in GTK+, no?
Comment 2 Michael Catanzaro 2015-01-18 15:05:21 UTC
I have no clue. I guess it's working as intended, and you should allow the user to scroll a little past the last line in the document as a workaround.
Comment 3 Christian Hergert 2015-01-18 22:24:30 UTC
Right, the fix here is to allow us to scroll past the end of the buffer up to say half-page.

Someone was working on this for GtkTextView at one point (nacho?), but I'm not sure it was finished.
Comment 4 Joaquim Rocha 2015-11-04 20:56:37 UTC
I just experimented this and looked for the bug before filing it myself. Adding the dependency on #92458.
Comment 5 Joaquim Rocha 2015-11-05 00:04:18 UTC
Created attachment 314862 [details] [review]
Add bottom margin to prevent hiding the last line

I noticed that we can scroll beyond the last line by using the bottom margin of the text view. I chose a value of 25 for the margin because it seems safe enough while not too big as the current padding seems (to me at least).

I have seen that in another editor, the last line just occupies two rows effectively so its bottom margin actually changes according to the font size. I chose not to mimic this effect as it seems like there should be no related between the font size and the problem we have (actually increasing the font makes the problem less annoying).
Comment 6 Joaquim Rocha 2015-11-05 00:05:07 UTC
Created attachment 314863 [details] [review]
Remove the theme's bottom padding

With the bottom margin patch, the theme hack is no longer needed.
Comment 7 Christian Hergert 2015-11-05 19:22:06 UTC
I took a quick look over this, and I'm not opposed to pushing it as is, but let me clarify on what my goal is.

I'd like the bottom margin to be the height of the (textview - line_height). This will allow us to do what emacs/vim can do of scrolling until the last line is at the top of the file.

That feature is pretty useful when writing new code at the end of the file. I know I rely on this quite a bit.

Once we have that, we can also remove our "stay pinned to the bottom" hack as well.
Comment 8 Christian Hergert 2015-11-05 19:22:41 UTC
s/top of the file/top of the viewport/
Comment 9 Joaquim Rocha 2015-11-05 22:17:19 UTC
Created attachment 314946 [details] [review]
Scroll beyond the last line leaving only this last line visible

Et voilà. Here is what I think you're looking for.

It allows to scroll beyond the last line leaving only this one visible.
To be honest, my Emacs does not do this, nor does QtCreator (they show an empty "row" a big bigger than one line) and so, scrolling so much that I get only the last line visible on the top does not seem natural to me but anyway...

About this new patch in order to still show the full line when the source view's scale factor is big, I have multiplied the line height by a value bigger than the biggest scale factor. This means that when the scale is normal, we can actually see more than just the very last line. This means that we can still improve this patch to always show only the very last line but for that we'd have to expose the scale factor from the source view, so I think by now this might suffice.

Hope you like it ;)
Comment 10 Joaquim Rocha 2015-11-05 22:21:46 UTC
Created attachment 314947 [details] [review]
Scroll beyond the last line leaving only this last line visible

[Reuploading the patch because I was missing a space between a function name and the (...]
Comment 11 Joaquim Rocha 2015-11-20 21:13:46 UTC
Created attachment 315993 [details] [review]
Implement overscroll

After talking to Christian Hergert, I have moved the implementation of the feature to the source view, made it changeable by a property and implemented it by using a number of lines to scroll beyond the bottom or to show after the top of the viewport.
Comment 12 Joaquim Rocha 2015-11-20 21:14:37 UTC
Created attachment 315994 [details] [review]
Add settings' schema and bind function for the overscroll

Settings' schema and bind function for the overscroll
Comment 13 Christian Hergert 2015-12-22 00:03:54 UTC
Thanks so much for doing this! It is significantly better than we had.

Also, my appologies for taking so long to merge, I was so focused on the perspectives branch I neglected a lot of outstanding patches.

I guess we should add a tunable in preferences for this, which should be very easy to do now. I'll do a follow up commit for that.
Comment 14 Christian Hergert 2015-12-22 00:04:07 UTC
Created attachment 317762 [details] [review]
editor: Add settings schema and bind for "overscroll"
Comment 15 Christian Hergert 2015-12-22 00:04:11 UTC
Created attachment 317763 [details] [review]
source-view: Use bottom margin to scroll beyond the last line

The overlay scrollbars can cover the last line which makes it
difficult to view and select it properly. These changes add a
bottom margin to allow scrolling beyond the last line.

This bottom margin can be set by using the property "overscroll"
which receives the number of lines to scroll beyond the end of the
buffer. If a negative number is given, it counts the lines from the
top of the viewport (instead of the bottom).
Comment 16 Christian Hergert 2015-12-22 00:19:32 UTC
Add preferences UI for overscroll
Comment 17 Christian Hergert 2015-12-22 00:20:25 UTC
Doh! It didn't reference my patch.

UI patch added in commit d998ed19a81a511b2881b2912ddc946f8517bc85.