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 741702 - Right margin not respected with RTL text in non-wrapping mode only
Right margin not respected with RTL text in non-wrapping mode only
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-12-18 08:42 UTC by sébastien lafargue
Modified: 2014-12-18 20:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
video of the bug in gedit (137.89 KB, video/webm)
2014-12-18 08:42 UTC, sébastien lafargue
  Details
patch for the bug (866 bytes, patch)
2014-12-18 08:44 UTC, sébastien lafargue
committed Details | Review
silent warning (758 bytes, patch)
2014-12-18 08:46 UTC, sébastien lafargue
committed Details | Review

Description sébastien lafargue 2014-12-18 08:42:25 UTC
Created attachment 292960 [details]
video of the bug in gedit

The right margin shown in a GtkTextView with some RTL text is not the good one
( only visible when not wrapped because of different code paths )

Actually, the right margin and the left margin are counted twice in calculation.
( see video attached )

You can reproduce the bug with gedit but also by pasting some RTL text in the multiview part of the gtk3-demo and by tweaking the right and left margins value in inspector.

To correct this, display->width ( which contain margins ) must be replaced by
PIXEL_BOUND (extents.width) ( the same quantity without margins )
Comment 1 sébastien lafargue 2014-12-18 08:44:28 UTC
Created attachment 292961 [details] [review]
patch for the bug
Comment 2 sébastien lafargue 2014-12-18 08:46:03 UTC
I also add a small patch to silence a gcc warning
Comment 3 sébastien lafargue 2014-12-18 08:46:26 UTC
Created attachment 292962 [details] [review]
silent warning
Comment 4 Ignacio Casal Quinteiro (nacho) 2014-12-18 18:24:56 UTC
Review of attachment 292962 [details] [review]:

Looks good.
Comment 5 Ignacio Casal Quinteiro (nacho) 2014-12-18 18:29:52 UTC
Review of attachment 292961 [details] [review]:

Add the comment, and then feel free to push it.

::: gtk/gtktextlayout.c
@@ +2474,3 @@
   if (pango_layout_get_width (display->layout) < 0)
     {
+      gint excess = display->total_width - PIXEL_BOUND (extents.width);

I'd say add a comment here about why this
Comment 6 Ignacio Casal Quinteiro (nacho) 2014-12-18 18:29:55 UTC
Review of attachment 292961 [details] [review]:

Add the comment, and then feel free to push it.

::: gtk/gtktextlayout.c
@@ +2474,3 @@
   if (pango_layout_get_width (display->layout) < 0)
     {
+      gint excess = display->total_width - PIXEL_BOUND (extents.width);

I'd say add a comment here about why this
Comment 7 sébastien lafargue 2014-12-18 20:03:27 UTC
Comment on attachment 292961 [details] [review]
patch for the bug

commited as 73c8f30
Comment 8 sébastien lafargue 2014-12-18 20:04:12 UTC
Comment on attachment 292962 [details] [review]
silent warning

commited as ce8dc51