GtkEntry placeholder renders above buffer text when buffer text is set before the buffer is appended.
Steps to reproduce
import gi
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk
def on_activate(app):
win = Gtk.ApplicationWindow(application=app)
entry = Gtk.Entry()
buffer = Gtk.EntryBuffer()
buffer.set_text("Hello World", 11)
entry.set_placeholder_text("Placeholder text")
entry.set_buffer(buffer)
win.set_child(entry)
win.present()
app = Gtk.Application(application_id='com.example.GtkApplication')
app.connect('activate', on_activate)
print(Gtk.get_major_version(), Gtk.get_minor_version(), Gtk.get_micro_version())
app.run(None)
Current behaviour
The EntryBuffer
text is shown above the "placeholder text" set inside of Entry
.
The bug does go away if we change the buffer content.
Expected outcome
Only EntryBuffer
text was shown and placeholder text should be hidden, as the buffer isn't empty.
Version information
GTK 4.4.0
Additional information
Closely relates to #4066 (closed).