GNOME Bugzilla – Bug 482688
Right Justified GtkTextView incorrectly places text
Last modified: 2018-04-15 00:21:12 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.
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()
*** Bug 515094 has been marked as a duplicate of this bug. ***
*** Bug 522477 has been marked as a duplicate of this bug. ***
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.
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()
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.
Bug still present in GTK+ 2.20.0...
*** Bug 539441 has been marked as a duplicate of this bug. ***
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.
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