GtkTag's paragraph-background property doesn't apply to empty newlines
Steps to reproduce
- Ad a GtkTag to some text including newlines
- Set its paragraph-background property to any color
Current behavior
Lines with just a \n
don't have the background color
Expected outcome
All lines to be filled, independent on their content
Version information
- GTK 4.16.5
- Fedora 41
- Wayland
Additional information
Reproducer
#include <gtk/gtk.h>
static void
activate (GtkApplication* app,
gpointer user_data)
{
GtkWidget *window;
GtkWidget *textview;
GtkTextBuffer *buffer;
GtkTextTag *tag;
GtkTextIter start, end;
window = gtk_application_window_new (app);
textview = gtk_text_view_new ();
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
tag = gtk_text_buffer_create_tag(buffer, "colored_paragraph", "paragraph-background", "pink");
gtk_text_buffer_set_text(buffer, "bob\n\nalice\ntest", -1);
gtk_text_buffer_get_bounds (buffer, &start, &end);
gtk_text_buffer_apply_tag(buffer, tag, &start, &end);
gtk_window_set_child (GTK_WINDOW (window), textview);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
gtk_window_present (GTK_WINDOW (window));
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
gcc $( pkg-config --cflags gtk4 ) -o run main.c $( pkg-config --libs gtk4 )
./run