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 380533 - Request for gtk_text_view_set_markup function
Request for gtk_text_view_set_markup function
Status: RESOLVED DUPLICATE of bug 59390
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
2.10.x
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-11-29 15:49 UTC by Blake Madden
Modified: 2006-11-29 18:15 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Blake Madden 2006-11-29 15:49:38 UTC
With a GtkLabel you can directly add marked up Text (using Pango syntax) using gtk_label_set_markup.  However, this functionality does not seem to exist for a GtkTextView.  Would it be possible to add a "gtk_text_view_set_markup" to the API so that you could drop Pango marked-up text right into a text view?  Thanks.
Comment 1 Havoc Pennington 2006-11-29 16:25:26 UTC
This is a dup of another bug I couldn't point to quickly ...

(the basic trick to this is that the text view uses tags to apply text styles, and there are no tags by default, they are all user-defined)
Comment 2 Blake Madden 2006-11-29 16:40:20 UTC
So, GtkTextView doesn't use Pango (or at least has no way to use pango_parse_markup)?
Comment 3 Havoc Pennington 2006-11-29 16:48:23 UTC
The only way to e.g. make text bold is to have a GtkTextTag that sets things to bold. By default there are no GtkTextTag defined, only apps define them.

The other bug has more discussion I think
Comment 4 Blake Madden 2006-11-29 17:34:50 UTC
Found it.  Yeah, bug #59390 offers a patch to do exactly what I was looking for by adding functions like "gtk_text_buffer_set_markup".  The bug is five years old and apparently rejected--is there a reason why this patch wasn't accepted?  Surely a lot of programmer are hoping for functionality.

Marking up the TextBuffer isn't really useful if your text formatting code is separate from the GUI code.  For example, in Win32 you can format a huge RTF string and drop it right into a Rich Edit control.  Being able to format a char* string with (Pango's) html markup and then dropping it into a GtkTextView would be very helpful for a lot of programmers I imagine.  Obviously someone that this would be convenient with labels (gtk_label_set_markup)--why would text views be any different?
Comment 5 Matthias Clasen 2006-11-29 17:38:54 UTC
Pango markup is not HTML.

As soon as we accept that patch, people will start clamoring for extending it until it is HTML...
Comment 6 Havoc Pennington 2006-11-29 17:48:31 UTC
marking the dup, thanks for tracking it down.


*** This bug has been marked as a duplicate of 59390 ***
Comment 7 Blake Madden 2006-11-29 18:15:59 UTC
How about call(In reply to comment #5)
> Pango markup is not HTML.
> 
> As soon as we accept that patch, people will start clamoring for extending it
> until it is HTML...
> 

How about calling the new functions something like "gtk_text_buffer_set_pango_markup" then? :-)  Actually, that doesn't sound like too bad of an idea.

I see what you mean, but I think most hackers would understand the limitations of Pango markup.  I think the number of people that would greatly appreciate this feature would outweigh the number of people who complain that the text view isn't loading their style sheets and java script.