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 482688 - Right Justified GtkTextView incorrectly places text
Right Justified GtkTextView incorrectly places text
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
2.12.x
Other Linux
: High major
: ---
Assigned To: gtk-bugs
gtk-bugs
: 515094 522477 539441 (view as bug list)
Depends on:
Blocks: 524602
 
 
Reported: 2007-10-02 18:17 UTC by Rich Burridge
Modified: 2018-04-15 00:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Rich Burridge 2007-10-02 18:17:37 UTC
Recent changes to gcalctool to fix bug #439087 have shown
what I believe is a bug in Gtk+

Steps to reproduce:

1/ Checkout the very latest gcalctool from SVN trunk and configure,
   build and install it.
2/ Start gcalctool. Make sure you are in arithmetic precedence mode
   using Dec numeric base (should be the default).
3/ Enter 8888888888888888888888888888*88888888888888888888888888888
   and hit Return. (You can Copy/Paste this string).
4/ The result:
   7.90123456790123456790123456703209876543209876543209876544e+56
   will be displayed. This will cause an horizontal scrollbar to appear.

Unfortunately the first digit of this result isn't being properly shown 
(you can't scroll that far).

The workaround is to resize gcalctool until the scrollbar disappears.
Comment 1 Robert Ancell 2007-11-27 10:21:31 UTC
Finally worked this bug out... This is a combination of using a right margin and right justification. The following program will show this:

import gtk

w = gtk.Window()

s = gtk.ScrolledWindow()
w.add(s)

v = gtk.TextView()
v.set_justification(gtk.JUSTIFY_RIGHT)
v.set_right_margin(6)
v.get_buffer().set_text('0'*100)
s.add(v)

w.show_all()

gtk.main()
Comment 2 Rich Burridge 2008-02-07 23:44:18 UTC
*** Bug 515094 has been marked as a duplicate of this bug. ***
Comment 3 Rich Burridge 2008-03-14 18:56:17 UTC
*** Bug 522477 has been marked as a duplicate of this bug. ***
Comment 4 Gavin Hamill 2008-06-05 13:37:46 UTC
Could this receive some attention, please?

GNOME has been shipping a desktop with a broken calculator - a faux-pas with such a trivial application is embarrassing.
Comment 5 Robert Ancell 2008-06-14 07:36:27 UTC
The problem is even more pronounced when using gtk_text_view_place_cursor(), in the following case the combination of:
1. Using right justify
2. Setting text that is wider than the widget
3. Setting text that is thinner than the widget and placing the cursor causes the new text to become invisible.

The text is displayed correctly when the widget is resized. 

===
import gtk

window = gtk.Window()
vbox = gtk.VBox()
window.add(vbox)

view = gtk.TextView()
buffer = view.get_buffer()
view.set_justification(gtk.JUSTIFY_RIGHT)
view.set_size_request(100, 40)
vbox.pack_start(view)

buffer.set_text("*" * 100)

button = gtk.Button("Show Bug")
vbox.pack_start(button)
def do_move_cursor(widget):
    buffer.set_text("HIDDEN")
    buffer.place_cursor(buffer.get_end_iter())
    return True
button.connect('clicked', do_move_cursor)

window.show_all()

gtk.main()
Comment 6 Robert Ancell 2008-06-14 09:19:24 UTC
I have made a hacky workaround for GCalctool in bug #524602 which sets the display twice. This workaround can be seen in the program in comment 5 by clicking the button twice.
Comment 7 Robert Ancell 2010-04-09 01:33:09 UTC
Bug still present in GTK+ 2.20.0...
Comment 8 Robert Ancell 2010-04-09 01:35:47 UTC
*** Bug 539441 has been marked as a duplicate of this bug. ***
Comment 9 Matthias Clasen 2018-02-10 05:20:17 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 10 Matthias Clasen 2018-04-15 00:21:12 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new