GtkTextView: various scroll fixes

Desktop / GNOME / GTK - Sebastien Lafargue [gnome.org] - 1 September 2015 21:42 UTC

The purpose of this patch is to fix regressions in GtkTextView scroll behaviours due to commit d138156. ( addition of padding and margins to the view )

Adding some padding is done by, for example, in inspector css tab with:

GtkTextView { padding: 10px 10px 10px 10px; }

and adding margins, by changing one of *-margin properties ( * standing for left/right/top/bottom ) or the corresponding accessor functions.

Understand that none of these bugs are easy to trigger. What's happened is that a old and wrong version of the code of the code ( lost in the mean time ) was pushed.

These bugs are best seen with wrap mode set to off.

The commit 8baab8f fix a first regression.

This one is about:

- Cursor going out of the view at line ends instead of being visible or triggering the horizontal scroll.

- Padding not displayed correctly when moving cursor at beginning/end of lines

- When horizontal scroll position not at left, cursor can make scroll by more than one character (you need left padding to see this )

- Moving the cursor arround, the rendered text can be shitted in x or y. ( fixed by converting adjustment float values to integer before calculations )

It can be observed by going down with the cursor more than the view height then going up

- retval return value of _gtk_text_view_scroll_to_iter wrong in some cases

In addition, this patch re-factor priv->top_border in screen_dest.y calculation

Of course, all GtkTextView and GtkSourceView based app were impacted by these bugs ( gedit for example, see bug 754147 )

https://bugzilla.gnome.org/show_bug.cgi?id=753815

https://bugzilla.gnome.org/show_bug.cgi?id=75815

9ad6ac0 GtkTextView: various scroll fixes
gtk/gtktextview.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)

Upstream: git.gnome.org


  • Share